?? u1.pas
字號:
{****************************************************************** }
{ 第一階段-開篇立論階段 }
{ }
{****************************************************************** }
unit u1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Buttons, MPlayer, jpeg, Menus;
type
TForm1 = class(TForm)
Label1: TLabel;
timer1: TTimer;
gbZh: TGroupBox;
lbZh: TLabel;
gbF: TGroupBox;
lbF: TLabel;
sbtnFStart: TSpeedButton;
ZhLeftTime: TLabel;
FLeftTime: TLabel;
Timer2: TTimer;
lb: TLabel;
Image1: TImage;
sbtnZhStart: TSpeedButton;
MainMenu1: TMainMenu;
N1: TMenuItem;
mmiZhColor: TMenuItem;
mmiZhBackColor: TMenuItem;
mmiFBackColor: TMenuItem;
mmiFColor: TMenuItem;
N6: TMenuItem;
N7: TMenuItem;
mmiExit: TMenuItem;
ColorDlg: TColorDialog;
procedure timer1Timer(Sender: TObject);
procedure sbtnZhStartClick(Sender: TObject);
procedure sbtnFStartClick(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure FormCreate(Sender: TObject);
procedure mmiExitClick(Sender: TObject);
procedure mmiZhColorClick(Sender: TObject);
procedure mmiZhBackColorClick(Sender: TObject);
procedure mmiFColorClick(Sender: TObject);
procedure mmiFBackColorClick(Sender: TObject);
private
{ Private declarations }
it :integer;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses
uMain;
const
TM:integer=1800;
// TM:integer=35;
{$R *.dfm}
{正方計時}
procedure TForm1.timer1Timer(Sender: TObject);
begin
ZhleftTime.Caption:=IntToTime(it);
if it=300 then
begin
beep1;
end;
if it=0 then
begin
uMain.beep2;
end;
it:=it-1;
end;
{反方計時}
procedure TForm1.sbtnZhStartClick(Sender: TObject);
begin
case sbtnZhStart.Tag of
0:
begin
sbtnZhStart.Caption:='停止計時';
lb.Caption:='正 方 計 時 中';
lb.Font:=sbtnZhStart.Font;
it:=TM;
timer1.Enabled:=True;
sbtnZhStart.Tag:=1;
end;
1:
begin
timer1.Enabled:=False;
sbtnZhStart.Enabled:=False;
sbtnFStart.Enabled:=True;
lb.Caption:='';
end;
end;
end;
procedure TForm1.sbtnFStartClick(Sender: TObject);
begin
case sbtnFStart.Tag of
0:
begin
sbtnFStart.Caption:='停止計時';
lb.Caption:='反 方 計 時 中';
lb.Font:=sbtnFStart.Font;
timer2.Enabled:=True;
it:=TM;
sbtnFStart.Tag:=1;
end;
1:
begin
timer2.Enabled:=False;
sbtnFStart.Enabled:=False;
lb.Caption:='';
end;
end;
end;
procedure TForm1.Timer2Timer(Sender: TObject);
begin
FleftTime.Caption:=IntToTime(it);
// FleftTime.Caption:=IntToStr(it)+'秒';
// if it=30 then
// begin
// beep;
// end;
if it=300 then
begin
beep1;
end;
if it=0 then
begin
uMain.beep2;
end;
it:=it-1;
end;
//////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
//// 按 Q 或 q 鍵 關閉窗體
//
////////////////////////////////////////////////////////////
procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
if (Key=#113) or (Key=#81) then
Close;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
it:=1800;
lbZh.Font.Color:=uMain.ZhFontColor;
ZhLeftTime.Font.Color:= uMain.ZhFontColor;
lbF.Font.Color:=uMain.FFontColor;
FLeftTime.Font.Color:= uMain.FFontColor;
gbZh.Color:=uMain.ZhBackgroundColor;
gbF.Color:=uMain.FBackgroundColor;
end;
procedure TForm1.mmiExitClick(Sender: TObject);
begin
Close;
end;
procedure TForm1.mmiZhColorClick(Sender: TObject);
begin
if ColorDlg.Execute then
begin
uMain.ZhFontColor:= ColorDlg.Color;
lbZh.Font.Color:=uMain.ZhFontColor;
ZhLeftTime.Font.Color:= uMain.ZhFontColor;
end;
end;
procedure TForm1.mmiZhBackColorClick(Sender: TObject);
begin
if ColorDlg.Execute then
begin
uMain.ZhBackgroundColor:= ColorDlg.Color;
gbZh.Color:=uMain.ZhBackgroundColor;
end;
end;
procedure TForm1.mmiFColorClick(Sender: TObject);
begin
if ColorDlg.Execute then
begin
uMain.FFontColor:= ColorDlg.Color;
lbF.Font.Color:=uMain.FFontColor;
FLeftTime.Font.Color:= uMain.FFontColor;
end;
end;
procedure TForm1.mmiFBackColorClick(Sender: TObject);
begin
if ColorDlg.Execute then
begin
uMain.FBackgroundColor:= ColorDlg.Color;
gbF.Color:=uMain.FBackgroundColor;
end;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -