Line | |
---|
1 | unit umetroui;
|
---|
2 |
|
---|
3 | {$mode objfpc}{$H+}
|
---|
4 |
|
---|
5 | interface
|
---|
6 |
|
---|
7 | uses
|
---|
8 | Forms, BGRAButton, Classes;
|
---|
9 |
|
---|
10 | type
|
---|
11 |
|
---|
12 | { TfrmMetroUI }
|
---|
13 |
|
---|
14 | TfrmMetroUI = class(TForm)
|
---|
15 | btn1: TBGRAButton;
|
---|
16 | btn10: TBGRAButton;
|
---|
17 | btn2: TBGRAButton;
|
---|
18 | btn3: TBGRAButton;
|
---|
19 | btn4: TBGRAButton;
|
---|
20 | btn5: TBGRAButton;
|
---|
21 | btn6: TBGRAButton;
|
---|
22 | btn7: TBGRAButton;
|
---|
23 | btn8: TBGRAButton;
|
---|
24 | btn9: TBGRAButton;
|
---|
25 | procedure FormCreate(Sender: TObject);
|
---|
26 | procedure FormResize(Sender: TObject);
|
---|
27 | private
|
---|
28 | { private declarations }
|
---|
29 | public
|
---|
30 | { public declarations }
|
---|
31 | end;
|
---|
32 |
|
---|
33 | var
|
---|
34 | frmMetroUI: TfrmMetroUI;
|
---|
35 |
|
---|
36 | implementation
|
---|
37 |
|
---|
38 | uses
|
---|
39 | bgrasamples;
|
---|
40 |
|
---|
41 | {$R *.lfm}
|
---|
42 |
|
---|
43 | { TfrmMetroUI }
|
---|
44 |
|
---|
45 | procedure TfrmMetroUI.FormCreate(Sender: TObject);
|
---|
46 | begin
|
---|
47 | // This call AccentColorButton for each TBGRAButton in the form
|
---|
48 | // using the TBGRAButton.Color property as parameter.
|
---|
49 | AccentColorButtonAll(Self);
|
---|
50 | end;
|
---|
51 |
|
---|
52 | procedure TfrmMetroUI.FormResize(Sender: TObject);
|
---|
53 | var
|
---|
54 | i: integer;
|
---|
55 | begin
|
---|
56 | // This set the Font.Height property for each TBGRAButton in the form
|
---|
57 | // when the form is resized to be 1/3 of the button height.
|
---|
58 | for i := 0 to Self.ControlCount - 1 do
|
---|
59 | begin
|
---|
60 | if Self.Controls[i] is TBGRAButton then
|
---|
61 | with Self.Controls[i] as TBGRAButton do
|
---|
62 | begin
|
---|
63 | BodyClicked.Font.Height := Trunc(Self.Controls[i].Height div 3);
|
---|
64 | BodyHover.Font.Height := Trunc(Self.Controls[i].Height div 3);
|
---|
65 | BodyNormal.Font.Height := Trunc(Self.Controls[i].Height div 3);
|
---|
66 | end;
|
---|
67 | end;
|
---|
68 | end;
|
---|
69 |
|
---|
70 | end.
|
---|
Note:
See
TracBrowser
for help on using the repository browser.