source: tags/1.3.1/Packages/CevoComponents/ButtonC.pas

Last change on this file was 431, checked in by chronos, 2 years ago
  • Modified: Changed WindowMode numerical constants to enumeration.
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 published
15 property Visible;
16 property ButtonIndex: integer read FIndex write SetIndex;
17 property OnClick;
18 protected
19 procedure Paint; override;
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.