source: trunk/Packages/bgracontrols/testbgracontrols/umetroui.pas

Last change on this file was 2, checked in by chronos, 5 years ago
File size: 1.4 KB
Line 
1unit umetroui;
2
3{$mode objfpc}{$H+}
4
5interface
6
7uses
8 Forms, BGRAButton, Classes;
9
10type
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
33var
34 frmMetroUI: TfrmMetroUI;
35
36implementation
37
38uses
39 bgrasamples;
40
41{$R *.lfm}
42
43{ TfrmMetroUI }
44
45procedure TfrmMetroUI.FormCreate(Sender: TObject);
46begin
47 // This call AccentColorButton for each TBGRAButton in the form
48 // using the TBGRAButton.Color property as parameter.
49 AccentColorButtonAll(Self);
50end;
51
52procedure TfrmMetroUI.FormResize(Sender: TObject);
53var
54 i: integer;
55begin
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;
68end;
69
70end.
Note: See TracBrowser for help on using the repository browser.