-
Notifications
You must be signed in to change notification settings - Fork 1
/
essentials1.pas
87 lines (78 loc) · 1.72 KB
/
essentials1.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
unit essentials1;
interface
uses
Winapi.Windows,
Winapi.Messages,
System.SysUtils,
System.Variants,
System.Classes,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs,
Vcl.StdCtrls,
Vcl.ExtCtrls,
Vcl.Menus, EsGrad;
type
TfrmMainForm = class(TForm)
MainMenu1: TMainMenu;
Examples1: TMenuItem;
InvoiceSample1: TMenuItem;
Background1: TMenuItem;
About1: TMenuItem;
bkGradient: TEsGradient;
procedure btnAboutClick(Sender: TObject);
procedure btnBackgroundClick(Sender: TObject);
procedure btnInvoiceClick(Sender: TObject);
private
public
end;
var
frmMainForm: TfrmMainForm;
implementation
uses
frmAbout,
frmInvoice,
frmSettings,
INIFiles;
{$R *.dfm}
procedure TfrmMainForm.btnAboutClick(Sender: TObject);
begin
TfrmAboutBox.Execute;
end;
procedure TfrmMainForm.btnBackgroundClick(Sender: TObject);
var
ini: TIniFile;
begin
TfrmSettingsForm.Execute;
ini := TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'settings.ini');
try
bkGradient.Visible := false;
var sVal := ini.ReadString('Settings', 'ColorGradientDirection', 'vertical');
if LowerCase(sVal) = 'horizontal' then begin
bkGradient.Direction := dHorizontal;
end else begin
bkGradient.Direction := dVertical;
end;
finally
ini.Free;
end;
end;
procedure TfrmMainForm.btnInvoiceClick(Sender: TObject);
var
iNo: Integer;
bFound: boolean;
begin
bFound := false;
for iNo := 0 to (MDIChildCount - 1) do begin
if (MDIChildren[iNo].ClassName = TfrmInvoiceForm.ClassName) then begin
bFound := true;
MDIChildren[iNo].BringToFront;
end;
end;
if (bFound = false) then begin
var frm := TfrmInvoiceForm.Create(Self);
frm.Show;
end;
end;
end.