Changeset 14 for trunk/Components/ButtonA.pas
- Timestamp:
- Jan 7, 2017, 8:54:23 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Components/ButtonA.pas
r10 r14 30 30 procedure Register; 31 31 begin 32 RegisterComponents('Samples', [TButtonA]);32 RegisterComponents('Samples', [TButtonA]); 33 33 end; 34 34 35 35 constructor TButtonA.Create(aOwner: TComponent); 36 36 begin 37 inherited Create(aOwner);38 FCaption:='';39 SetBounds(0,0,100,25);37 inherited Create(aOwner); 38 FCaption := ''; 39 SetBounds(0, 0, 100, 25); 40 40 end; 41 41 42 42 procedure TButtonA.Paint; 43 43 begin 44 with Canvas do45 if FGraphic<>nil then44 with Canvas do 45 if FGraphic <> nil then 46 46 begin 47 BitBlt(Canvas.Handle,0,0,100,25,Graphic.Canvas.Handle,48 195,243+26*Byte(Down),SRCCOPY);49 Canvas.Brush.Style:=bsClear;50 Textout(50-(TextWidth(FCaption)+1) div 2,12-textheight(FCaption) div 2,51 FCaption);47 BitBlt(Canvas.Handle, 0, 0, 100, 25, Graphic.Canvas.Handle, 195, 48 243 + 26 * Byte(Down), SRCCOPY); 49 Canvas.Brush.Style := bsClear; 50 Textout(50 - (TextWidth(FCaption) + 1) div 2, 12 - textheight(FCaption) 51 div 2, FCaption); 52 52 end 53 else begin Brush.Color:=$0000FF; FrameRect(Rect(0,0,100,25)) end 53 else 54 begin 55 Brush.Color := $0000FF; 56 FrameRect(Rect(0, 0, 100, 25)) 57 end 54 58 end; 55 59 56 60 procedure TButtonA.SetCaption(x: string); 57 61 begin 58 if x<>FCaption then62 if x <> FCaption then 59 63 begin 60 FCaption:=x;61 Invalidate64 FCaption := x; 65 Invalidate 62 66 end 63 67 end; … … 65 69 procedure TButtonA.SetFont(const x: TFont); 66 70 begin 67 Canvas.Font.Assign(x);68 Canvas.Font.Color:=$000000;71 Canvas.Font.Assign(x); 72 Canvas.Font.Color := $000000; 69 73 end; 70 74 71 75 end. 72
Note:
See TracChangeset
for help on using the changeset viewer.