-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainForm.pas
More file actions
177 lines (147 loc) · 4.04 KB
/
MainForm.pas
File metadata and controls
177 lines (147 loc) · 4.04 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
unit MainForm;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ComCtrls, Vcl.StdCtrls, Vcl.ExtCtrls,
Vcl.Imaging.pngimage, System.Actions, Vcl.ActnList, Vcl.Menus;
type
TForm1 = class(TForm)
pnlTimer: TPanel;
chkAllWayTop: TCheckBox;
btn1Hour: TButton;
Image1: TImage;
Timer1: TTimer;
L_couterTime: TLabel;
L_couterTime2: TLabel;
btn50M: TButton;
btn30M: TButton;
btn25M: TButton;
btn10M: TButton;
btn5M: TButton;
TrayIcon1: TTrayIcon;
PopupMenu1: TPopupMenu;
ActionList1: TActionList;
actClose: TAction;
N3: TMenuItem;
procedure chkAllWayTopClick(Sender: TObject);
procedure btn1HourClick(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure btn50MClick(Sender: TObject);
procedure btn30MClick(Sender: TObject);
procedure btn10MClick(Sender: TObject);
procedure btn25MClick(Sender: TObject);
procedure btn5MClick(Sender: TObject);
procedure actCloseExecute(Sender: TObject);
procedure FormPaint(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
var
BarSize: Double = 600;
globaltime: Integer;
TimeThrow: Integer;
defaultTime: Integer;
{$R *.dfm}
procedure TForm1.actCloseExecute(Sender: TObject);
begin
close;
end;
procedure TForm1.btn10MClick(Sender: TObject);
begin
L_couterTime.Caption := '00 : 10 : 00';
L_couterTime2.Caption := '00 : 10 : 00';
pnlTimer.Width := 100;
BarSize := 100;
globaltime := 600;
defaultTime := 600;
TimeThrow := 0;
Timer1.Enabled := True;
end;
procedure TForm1.btn1HourClick(Sender: TObject);
begin
L_couterTime.Caption := '01 : 00 : 00';
L_couterTime2.Caption := '01 : 00 : 00';
pnlTimer.Width := 600;
BarSize := 600;
globaltime := 3600;
defaultTime := 3600;
TimeThrow := 0;
Timer1.Enabled := True;
end;
procedure TForm1.btn25MClick(Sender: TObject);
begin
L_couterTime.Caption := '00 : 25 : 00';
L_couterTime2.Caption := '00 : 25 : 00';
pnlTimer.Width := 250;
BarSize := 250;
globaltime := 1500;
defaultTime := 1500;
TimeThrow := 0;
Timer1.Enabled := True;
end;
procedure TForm1.btn30MClick(Sender: TObject);
begin
L_couterTime.Caption := '00 : 30 : 00';
L_couterTime2.Caption := '00 : 30 : 00';
pnlTimer.Width := 300;
BarSize := 300;
globaltime := 1800;
defaultTime := 1800;
TimeThrow := 0;
Timer1.Enabled := True;
end;
procedure TForm1.btn50MClick(Sender: TObject);
begin
L_couterTime.Caption := '00 : 50 : 00';
L_couterTime2.Caption := '00 : 50 : 00';
pnlTimer.Width := 500;
BarSize := 500;
globaltime := 3000;
defaultTime := 3000;
TimeThrow := 0;
Timer1.Enabled := True;
end;
procedure TForm1.btn5MClick(Sender: TObject);
begin
L_couterTime.Caption := '00 : 05 : 00';
L_couterTime2.Caption := '00 : 05 : 00';
pnlTimer.Width := 50;
BarSize := 50;
globaltime := 300;
defaultTime := 300;
TimeThrow := 0;
Timer1.Enabled := True;
end;
procedure TForm1.chkAllWayTopClick(Sender: TObject);
begin
if chkAllWayTop.Checked then
FormStyle := fsStayOnTop
else
formstyle := fsNormal;
end;
procedure TForm1.FormPaint(Sender: TObject);
begin
ShowWindow(Application.Handle, SW_HIDE);
SetWindowLong(Application.Handle, GWL_EXSTYLE, GetWindowLong(Application.Handle, GWL_EXSTYLE) or WS_EX_TOOLWINDOW);
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
timethrow := TimeThrow + 1;
BarSize := ((defaultTime - timethrow) / 3600 * 100) * 6;
pnlTimer.Width := Trunc(BarSize);
globaltime := globaltime -1;
L_couterTime.Caption := FormatFloat('00',globaltime div 3600)
+ ' : ' + FormatFloat('00',globaltime div 60 mod 60) + ' : ' + FormatFloat('00',globaltime mod 60);
L_couterTime2.Caption := FormatFloat('00',globaltime div 3600)
+ ' : ' + FormatFloat('00',globaltime div 60 mod 60) + ' : ' + FormatFloat('00',globaltime mod 60);
if globaltime <= 0 then
begin
Timer1.Enabled := false;
end;
end;
end.