source: branches/delphi/ButtonC.pas

Last change on this file was 2, checked in by chronos, 7 years ago
File size: 1.0 KB
Line 
1unit ButtonC;
2
3interface
4
5uses
6 ButtonBase,
7 WinProcs, Classes, Graphics;
8
9type
10 TButtonC = class(TButtonBase)
11 constructor Create(aOwner: TComponent); override;
12 private
13 FIndex: integer;
14 procedure SetIndex(x: integer);
15 published
16 property Visible;
17 property ButtonIndex: integer read FIndex write SetIndex;
18 property OnClick;
19 protected
20 procedure Paint; override;
21 end;
22
23procedure Register;
24
25implementation
26
27procedure Register;
28begin
29RegisterComponents('Samples', [TButtonC]);
30end;
31
32constructor TButtonC.Create;
33begin
34inherited Create(aOwner);
35ShowHint:=true;
36SetBounds(0,0,12,12);
37end;
38
39procedure TButtonC.Paint;
40begin
41with Canvas do
42 if FGraphic<>nil then
43 BitBlt(Canvas.Handle,0,0,12,12,FGraphic.Canvas.Handle,
44 169+13*Byte(FDown),159+13*FIndex,SRCCOPY)
45 else begin Brush.Color:=$0000FF; FrameRect(Rect(0,0,12,12)) end
46end;
47
48procedure TButtonC.SetIndex(x: integer);
49begin
50if x<>FIndex then
51 begin
52 FIndex:=x;
53 Invalidate
54 end
55end;
56
57end.
58
Note: See TracBrowser for help on using the repository browser.