1 | unit TtMain;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | Windows, SysUtils, Classes, Controls, Forms, Dialogs, StdCtrls,
|
---|
7 | ExtCtrls, ComCtrls, Menus, Graphics, CoolTrayIcon, TextTrayIcon;
|
---|
8 |
|
---|
9 | type
|
---|
10 | TMainForm = class(TForm)
|
---|
11 | Timer1: TTimer;
|
---|
12 | FontDialog1: TFontDialog;
|
---|
13 | ColorDialog1: TColorDialog;
|
---|
14 | Button1: TButton;
|
---|
15 | Button2: TButton;
|
---|
16 | Button3: TButton;
|
---|
17 | Button7: TButton;
|
---|
18 | GroupBox1: TGroupBox;
|
---|
19 | Label1: TLabel;
|
---|
20 | Edit1: TEdit;
|
---|
21 | CheckBox1: TCheckBox;
|
---|
22 | CheckBox2: TCheckBox;
|
---|
23 | Button4: TButton;
|
---|
24 | Button5: TButton;
|
---|
25 | Button6: TButton;
|
---|
26 | Label2: TLabel;
|
---|
27 | Edit2: TEdit;
|
---|
28 | UpDown2: TUpDown;
|
---|
29 | Label3: TLabel;
|
---|
30 | Edit3: TEdit;
|
---|
31 | UpDown3: TUpDown;
|
---|
32 | Label4: TLabel;
|
---|
33 | Edit4: TEdit;
|
---|
34 | UpDown4: TUpDown;
|
---|
35 | TrayIcon1: TTextTrayIcon;
|
---|
36 | procedure FormCreate(Sender: TObject);
|
---|
37 | procedure FormDestroy(Sender: TObject);
|
---|
38 | procedure Edit1Change(Sender: TObject);
|
---|
39 | procedure CheckBox1Click(Sender: TObject);
|
---|
40 | procedure CheckBox2Click(Sender: TObject);
|
---|
41 | procedure Button1Click(Sender: TObject);
|
---|
42 | procedure Button2Click(Sender: TObject);
|
---|
43 | procedure Button3Click(Sender: TObject);
|
---|
44 | procedure Button4Click(Sender: TObject);
|
---|
45 | procedure Button5Click(Sender: TObject);
|
---|
46 | procedure Button6Click(Sender: TObject);
|
---|
47 | procedure Button7Click(Sender: TObject);
|
---|
48 | procedure Timer1Timer(Sender: TObject);
|
---|
49 | procedure TrayIcon1MouseDown(Sender: TObject; Button: TMouseButton;
|
---|
50 | Shift: TShiftState; X, Y: Integer);
|
---|
51 | procedure Edit2Change(Sender: TObject);
|
---|
52 | procedure Edit3Change(Sender: TObject);
|
---|
53 | procedure Edit4Change(Sender: TObject);
|
---|
54 | private
|
---|
55 | TrayCounter: Integer;
|
---|
56 | LoopNumbers: Boolean;
|
---|
57 | BgIcon: TIcon;
|
---|
58 | end;
|
---|
59 |
|
---|
60 | var
|
---|
61 | MainForm: TMainForm;
|
---|
62 |
|
---|
63 | implementation
|
---|
64 |
|
---|
65 | {$R *.DFM}
|
---|
66 |
|
---|
67 | procedure TMainForm.FormCreate(Sender: TObject);
|
---|
68 | begin
|
---|
69 | BgIcon := TIcon.Create;
|
---|
70 | BgIcon.Assign(TrayIcon1.BackgroundIcon);
|
---|
71 | Edit1Change(Self);
|
---|
72 | CheckBox1Click(Self);
|
---|
73 | CheckBox2Click(Self);
|
---|
74 | Edit2Change(Self);
|
---|
75 | Edit3Change(Self);
|
---|
76 | Edit4Change(Self);
|
---|
77 | end;
|
---|
78 |
|
---|
79 |
|
---|
80 | procedure TMainForm.FormDestroy(Sender: TObject);
|
---|
81 | begin
|
---|
82 | BgIcon.Free;
|
---|
83 | end;
|
---|
84 |
|
---|
85 |
|
---|
86 | procedure TMainForm.Button7Click(Sender: TObject);
|
---|
87 | begin
|
---|
88 | Close;
|
---|
89 | end;
|
---|
90 |
|
---|
91 |
|
---|
92 | procedure TMainForm.Timer1Timer(Sender: TObject);
|
---|
93 | begin
|
---|
94 | if TrayCounter < 91 then
|
---|
95 | begin
|
---|
96 | if LoopNumbers then
|
---|
97 | Edit1.Text := IntToStr(TrayCounter-65)
|
---|
98 | else
|
---|
99 | // Edit1.Text := Char(TrayCounter) + #13 + Char(TrayCounter+32);
|
---|
100 | Edit1.Text := Char(TrayCounter) + Char(TrayCounter) + #13 + Char(TrayCounter) + Char(TrayCounter);
|
---|
101 | Inc(TrayCounter);
|
---|
102 | end;
|
---|
103 | if TrayCounter = 91 then
|
---|
104 | TrayCounter := 65;
|
---|
105 | end;
|
---|
106 |
|
---|
107 |
|
---|
108 | procedure TMainForm.Button1Click(Sender: TObject);
|
---|
109 | begin
|
---|
110 | // Loop numbers
|
---|
111 | LoopNumbers := True;
|
---|
112 | TrayCounter := 65;
|
---|
113 | Timer1.Enabled := True;
|
---|
114 | end;
|
---|
115 |
|
---|
116 |
|
---|
117 | procedure TMainForm.Button2Click(Sender: TObject);
|
---|
118 | begin
|
---|
119 | // Loop characters
|
---|
120 | LoopNumbers := False;
|
---|
121 | TrayCounter := 65;
|
---|
122 | Timer1.Enabled := True;
|
---|
123 | end;
|
---|
124 |
|
---|
125 |
|
---|
126 | procedure TMainForm.Button3Click(Sender: TObject);
|
---|
127 | begin
|
---|
128 | Timer1.Enabled := False;
|
---|
129 | end;
|
---|
130 |
|
---|
131 |
|
---|
132 | procedure TMainForm.Button4Click(Sender: TObject);
|
---|
133 | begin
|
---|
134 | FontDialog1.Font.Assign(TrayIcon1.Font);
|
---|
135 | if FontDialog1.Execute then
|
---|
136 | TrayIcon1.Font.Assign(FontDialog1.Font);
|
---|
137 | // Alternative: TrayIcon1.Font := FontDialog1.Font;
|
---|
138 | end;
|
---|
139 |
|
---|
140 |
|
---|
141 | procedure TMainForm.Button5Click(Sender: TObject);
|
---|
142 | begin
|
---|
143 | ColorDialog1.Color := TrayIcon1.Color;
|
---|
144 | if ColorDialog1.Execute then
|
---|
145 | TrayIcon1.Color := ColorDialog1.Color;
|
---|
146 | end;
|
---|
147 |
|
---|
148 |
|
---|
149 | procedure TMainForm.Button6Click(Sender: TObject);
|
---|
150 | begin
|
---|
151 | ColorDialog1.Color := TrayIcon1.BorderColor;
|
---|
152 | if ColorDialog1.Execute then
|
---|
153 | TrayIcon1.BorderColor := ColorDialog1.Color;
|
---|
154 | end;
|
---|
155 |
|
---|
156 |
|
---|
157 | procedure TMainForm.Edit1Change(Sender: TObject);
|
---|
158 | begin
|
---|
159 | TrayIcon1.Text := Edit1.Text;
|
---|
160 | end;
|
---|
161 |
|
---|
162 |
|
---|
163 | procedure TMainForm.CheckBox1Click(Sender: TObject);
|
---|
164 | begin
|
---|
165 | TrayIcon1.Border := CheckBox1.Checked;
|
---|
166 | end;
|
---|
167 |
|
---|
168 |
|
---|
169 | procedure TMainForm.CheckBox2Click(Sender: TObject);
|
---|
170 | begin
|
---|
171 | if CheckBox2.Checked then
|
---|
172 | TrayIcon1.BackgroundIcon := BgIcon
|
---|
173 | else
|
---|
174 | TrayIcon1.BackgroundIcon := nil;
|
---|
175 | end;
|
---|
176 |
|
---|
177 |
|
---|
178 | procedure TMainForm.Edit2Change(Sender: TObject);
|
---|
179 | begin
|
---|
180 | TrayIcon1.Options.OffsetX := StrToInt(Edit2.Text);
|
---|
181 | end;
|
---|
182 |
|
---|
183 |
|
---|
184 | procedure TMainForm.Edit3Change(Sender: TObject);
|
---|
185 | begin
|
---|
186 | TrayIcon1.Options.OffsetY := StrToInt(Edit3.Text);
|
---|
187 | end;
|
---|
188 |
|
---|
189 |
|
---|
190 | procedure TMainForm.Edit4Change(Sender: TObject);
|
---|
191 | begin
|
---|
192 | TrayIcon1.Options.LineDistance := StrToInt(Edit4.Text);
|
---|
193 | end;
|
---|
194 |
|
---|
195 |
|
---|
196 | procedure TMainForm.TrayIcon1MouseDown(Sender: TObject;
|
---|
197 | Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
---|
198 | begin
|
---|
199 | // Timer1.Enabled := not Timer1.Enabled;
|
---|
200 | end;
|
---|
201 |
|
---|
202 | end.
|
---|
203 |
|
---|