Changeset 210 for branches/highdpi/Packages/CevoComponents/ButtonB.pas
- Timestamp:
- May 9, 2020, 4:02:07 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/Packages/CevoComponents/ButtonB.pas
r179 r210 4 4 5 5 uses 6 ButtonBase, Classes, Graphics, LCLIntf, LCLType, UDpiControls;6 UDpiControls, ButtonBase, Classes, Graphics, LCLIntf, LCLType; 7 7 8 8 type … … 12 12 FMask: TDpiBitmap; 13 13 FIndex: integer; 14 procedure SetIndex( x: integer);14 procedure SetIndex(Text: integer); 15 15 public 16 16 property Mask: TDpiBitmap read FMask write FMask; … … 25 25 procedure Register; 26 26 27 27 28 implementation 29 30 uses 31 ScreenTools; 28 32 29 33 procedure Register; 30 34 begin 31 RegisterComponents(' Samples', [TButtonB]);35 RegisterComponents('C-evo', [TButtonB]); 32 36 end; 33 37 … … 35 39 begin 36 40 inherited Create(aOwner); 37 ShowHint := true;41 ShowHint := True; 38 42 SetBounds(0, 0, 25, 25); 39 43 end; … … 42 46 begin 43 47 with Canvas do 44 if FGraphic <> nil then 45 begin 46 DpiBitBlt(Canvas.Handle, 0, 0, 25, 25, FGraphic.Canvas.Handle, 169, 47 243 + 26 * Byte(FDown), SRCCOPY); 48 if FIndex >= 0 then 49 begin 50 DpiBitBlt(Canvas.Handle, 0, 0, 25, 25, FMask.Canvas.Handle, 48 if FGraphic <> nil then begin 49 DpiBitCanvas(Canvas, 0, 0, 25, 25, FGraphic.Canvas, 169, 50 243 + 26 * Byte(FDown)); 51 if FIndex >= 0 then begin 52 DpiBitCanvas(Canvas, 0, 0, 25, 25, FMask.Canvas, 51 53 1 + FIndex mod 12 * 26, 337 + FIndex div 12 * 26, SRCAND); 52 DpiBit Blt(Canvas.Handle, 0, 0, 25, 25, FGraphic.Canvas.Handle,54 DpiBitCanvas(Canvas, 0, 0, 25, 25, FGraphic.Canvas, 53 55 1 + FIndex mod 12 * 26, 337 + FIndex div 12 * 26, SRCPAINT); 54 56 end 55 end 56 else 57 begin 57 end else begin 58 58 Brush.Color := $0000FF; 59 FrameRect(Rect(0, 0, 25, 25)) 60 end 59 FrameRect(Rect(0, 0, 25, 25)); 60 end; 61 61 end; 62 62 63 procedure TButtonB.SetIndex( x: integer);63 procedure TButtonB.SetIndex(Text: integer); 64 64 begin 65 if x <> FIndex then 66 begin 67 FIndex := x; 68 Invalidate 69 end 65 if Text <> FIndex then begin 66 FIndex := Text; 67 Invalidate; 68 end; 70 69 end; 71 70
Note:
See TracChangeset
for help on using the changeset viewer.