Changeset 95 for trunk/UControls.pas
- Timestamp:
- Sep 28, 2022, 12:23:17 AM (20 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UControls.pas
r86 r95 18 18 Bounds: TRect; 19 19 Canvas: TCanvas; 20 procedure MouseUp(Position: TPoint); 20 21 constructor Create; virtual; 21 22 procedure Paint; virtual; 22 23 property Enabled: Boolean read FEnabled write SetEnabled; 23 24 property OnClick: TNotifyEvent read FOnClick write FOnClick; 25 end; 26 27 { TLabel } 28 29 TLabel = class(TControl) 30 Text: string; 31 procedure Paint; override; 24 32 end; 25 33 … … 44 52 implementation 45 53 54 { TLabel } 55 56 procedure TLabel.Paint; 57 begin 58 if Assigned(Canvas) then 59 with Canvas do begin 60 TextOut(Bounds.Left, Bounds.Top, Text); 61 end; 62 end; 63 46 64 { TButton } 47 65 … … 58 76 FEnabled := AValue; 59 77 if Assigned(Canvas) then Paint; 78 end; 79 80 procedure TControl.MouseUp(Position: TPoint); 81 begin 82 if Bounds.Contains(Position) then 83 if Assigned(FOnClick) then FOnClick(Self); 60 84 end; 61 85
Note:
See TracChangeset
for help on using the changeset viewer.