Changeset 210 for branches/highdpi/Packages/CevoComponents/ButtonA.pas
- Timestamp:
- May 9, 2020, 4:02:07 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/Packages/CevoComponents/ButtonA.pas
r178 r210 4 4 5 5 uses 6 ButtonBase, 7 Classes, Graphics, LCLIntf, LCLType, UDpiControls; 6 UDpiControls, ButtonBase, Classes, Graphics, LCLIntf, LCLType, ScreenTools; 8 7 9 8 type … … 12 11 private 13 12 FCaption: string; 14 procedure SetCaption( x: string);15 procedure SetFont(const x: TDpiFont);13 procedure SetCaption(Text: string); 14 procedure SetFont(const Font: TDpiFont); 16 15 published 17 16 property Visible; … … 26 25 procedure Register; 27 26 27 28 28 implementation 29 29 30 30 procedure Register; 31 31 begin 32 RegisterComponents(' Samples', [TButtonA]);32 RegisterComponents('C-evo', [TButtonA]); 33 33 end; 34 34 … … 43 43 begin 44 44 with Canvas do 45 if FGraphic <> nil then begin 46 DpiBitBlt(Canvas.Handle, 0, 0, 100, 25, Graphic.Canvas.Handle, 195, 47 243 + 26 * Byte(Down), SRCCOPY); 45 if FGraphic <> nil then 46 begin 47 DpiBitCanvas(Canvas, 0, 0, 100, 25, Graphic.Canvas, 195, 48 243 + 26 * Byte(Down)); 48 49 Canvas.Brush.Style := bsClear; 49 Text Out(50 - (TextWidth(FCaption) + 1) div 2, 12 - TextHeight(FCaption)50 Textout(50 - (TextWidth(FCaption) + 1) div 2, 12 - textheight(FCaption) 50 51 div 2, FCaption); 51 end else begin 52 end 53 else 54 begin 52 55 Brush.Color := $0000FF; 53 56 FrameRect(Rect(0, 0, 100, 25)) 54 end 57 end; 55 58 end; 56 59 57 procedure TButtonA.SetCaption( x: string);60 procedure TButtonA.SetCaption(Text: string); 58 61 begin 59 if x <> FCaption then 60 begin 61 FCaption := x; 62 Invalidate 63 end 62 if Text <> FCaption then begin 63 FCaption := Text; 64 Invalidate; 65 end; 64 66 end; 65 67 66 procedure TButtonA.SetFont(const x: TDpiFont);68 procedure TButtonA.SetFont(const Font: TDpiFont); 67 69 begin 68 Canvas.Font.Assign( x);70 Canvas.Font.Assign(Font); 69 71 Canvas.Font.Color := $000000; 70 72 end;
Note:
See TracChangeset
for help on using the changeset viewer.