Changeset 734 for trunk/Packages/CevoComponents/ButtonB.pas
- Timestamp:
- Jan 17, 2026, 4:57:01 PM (11 hours ago)
- File:
-
- 1 edited
-
trunk/Packages/CevoComponents/ButtonB.pas (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/CevoComponents/ButtonB.pas
r554 r734 4 4 5 5 uses 6 ButtonBase, Classes, LCLIntf, LCLType, 6 ButtonBase, Classes, LCLIntf, LCLType, SysUtils, 7 7 {$IFDEF DPI}Dpi.Graphics{$ELSE}Graphics{$ENDIF}; 8 8 9 9 type 10 11 { TButtonB } 12 10 13 TButtonB = class(TButtonBase) 11 constructor Create(AOwner: TComponent); override;12 14 private 13 15 FMask: TBitmap; 14 16 FIndex: Integer; 17 FBuffer: TBitmap; 15 18 procedure SetIndex(Text: Integer); 16 19 protected 17 20 procedure Paint; override; 18 21 public 22 constructor Create(AOwner: TComponent); override; 23 destructor Destroy; override; 19 24 property Mask: TBitmap read FMask write FMask; 20 25 published … … 37 42 end; 38 43 39 constructor TButtonB.Create (AOwner: TComponent);44 constructor TButtonB.Create; 40 45 begin 41 46 inherited; 42 47 ShowHint := True; 43 48 SetBounds(0, 0, 25, 25); 49 FBuffer := TBitmap.Create; 50 FBuffer.PixelFormat := TPixelFormat.pf24bit; 51 FBuffer.SetSize(Width, Height); 52 FBuffer.Canvas.FillRect(0, 0, FBuffer.Width, FBuffer.Height); 53 end; 54 55 destructor TButtonB.Destroy; 56 begin 57 FreeAndNil(FBuffer); 58 inherited; 44 59 end; 45 60 … … 48 63 with Canvas do 49 64 if FGraphic <> nil then begin 50 BitBltCanvas(Canvas, 0, 0, 25, 25, FGraphic.Canvas, 169, 65 UnshareBitmap(FBuffer); 66 BitBltBitmap(FBuffer, 0, 0, Width, Height, FGraphic, 169, 51 67 243 + 26 * Byte(FDown)); 52 68 if FIndex >= 0 then begin 53 BitBlt Canvas(Canvas, 0, 0, 25, 25, FMask.Canvas,69 BitBltBitmap(FBuffer, 0, 0, Width, Height, FMask, 54 70 1 + FIndex mod 12 * 26, 337 + FIndex div 12 * 26, SRCAND); 55 BitBlt Canvas(Canvas, 0, 0, 25, 25, FGraphic.Canvas,71 BitBltBitmap(FBuffer, 0, 0, Width, Height, FGraphic, 56 72 1 + FIndex mod 12 * 26, 337 + FIndex div 12 * 26, SRCPAINT); 57 73 end; 74 BitBltCanvas(Canvas, 0, 0, Width, Height, FBuffer.Canvas, 0, 0); 58 75 end else begin 59 76 Brush.Color := $0000FF; 60 FrameRect(Rect(0, 0, 25, 25));77 FrameRect(Rect(0, 0, Width, Height)); 61 78 end; 79 inherited; 62 80 end; 63 81
Note:
See TracChangeset
for help on using the changeset viewer.
