source: trunk/Packages/CevoComponents/ButtonC.pas

Last change on this file was 554, checked in by chronos, 3 weeks ago
  • Added: TButtonG class as a button class component referencing TGraphicSet item.
  • Modified: Code cleanup.
File size: 1.1 KB
Line 
1unit ButtonC;
2
3interface
4
5uses
6 ButtonBase, Classes, Graphics, LCLIntf, LCLType, ScreenTools;
7
8type
9 TButtonC = class(TButtonBase)
10 constructor Create(AOwner: TComponent); override;
11 private
12 FIndex: Integer;
13 procedure SetIndex(Text: Integer);
14 protected
15 procedure Paint; override;
16 published
17 property Visible;
18 property ButtonIndex: Integer read FIndex write SetIndex;
19 property OnClick;
20 end;
21
22procedure Register;
23
24
25implementation
26
27procedure Register;
28begin
29 RegisterComponents('C-evo', [TButtonC]);
30end;
31
32constructor TButtonC.Create(AOwner: TComponent);
33begin
34 inherited;
35 ShowHint := True;
36 SetBounds(0, 0, 12, 12);
37end;
38
39procedure TButtonC.Paint;
40begin
41 with Canvas do
42 if FGraphic <> nil then
43 BitBltCanvas(Canvas, 0, 0, 12, 12, FGraphic.Canvas,
44 169 + 13 * Byte(FDown), 159 + 13 * FIndex)
45 else
46 begin
47 Brush.Color := $0000FF;
48 FrameRect(Rect(0, 0, 12, 12));
49 end;
50end;
51
52procedure TButtonC.SetIndex(Text: Integer);
53begin
54 if Text <> FIndex then
55 begin
56 FIndex := Text;
57 Invalidate;
58 end;
59end;
60
61end.
Note: See TracBrowser for help on using the repository browser.