u4.pas
资源名称:辩论赛计时器.rar [点击查看]
上传用户:pegasus
上传日期:2013-04-14
资源大小:3825k
文件大小:3k
源码类别:
教育系统应用
开发平台:
Delphi
- {****************************************************************** }
- { 第四阶段-总结陈辞阶段 }
- { }
- {****************************************************************** }
- unit u4;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, StdCtrls, ExtCtrls, Buttons, jpeg;
- type
- TForm4 = class(TForm)
- Label1: TLabel;
- timer1: TTimer;
- gbZh: TGroupBox;
- sbtnZhStart: TSpeedButton;
- gbF: TGroupBox;
- sbtnFStart: TSpeedButton;
- Timer2: TTimer;
- Image3: TImage;
- lbZh: TLabel;
- ZhLeftTime: TLabel;
- FLeftTime: TLabel;
- lbF: TLabel;
- 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);
- private
- { Private declarations }
- it :integer;
- public
- { Public declarations }
- end;
- var
- Form4: TForm4;
- implementation
- uses
- uMain;
- const
- TM:integer=1800;
- //TM:integer=350;
- {$R *.dfm}
- procedure TForm4.timer1Timer(Sender: TObject);
- begin
- ZhleftTime.Caption:=IntToTime(it);
- if it=300 then
- begin
- beep;
- end;
- if it=0 then
- begin
- uMain.beep2;
- end;
- it:=it-1;
- end;
- procedure TForm4.sbtnZhStartClick(Sender: TObject);
- begin
- case sbtnZhStart.Tag of
- 0:
- begin
- sbtnZhStart.Caption:='停止计时';
- it:=TM;
- timer1.Enabled:=True;
- sbtnZhStart.Tag:=1;
- end;
- 1:
- begin
- timer1.Enabled:=False;
- sbtnZhStart.Enabled:=False;
- end;
- end;
- end;
- procedure TForm4.sbtnFStartClick(Sender: TObject);
- begin
- case sbtnFStart.Tag of
- 0:
- begin
- sbtnFStart.Caption:='停止计时';
- timer2.Enabled:=True;
- it:=TM;
- sbtnFStart.Tag:=1;
- end;
- 1:
- begin
- timer2.Enabled:=False;
- sbtnFStart.Enabled:=False;
- sbtnZhStart.Enabled:=True;
- end;
- end;
- end;
- procedure TForm4.Timer2Timer(Sender: TObject);
- begin
- FleftTime.Caption:=IntToTime(it);
- if it=300 then
- begin
- beep1;
- end;
- if it=0 then
- begin
- uMain.beep2;
- end;
- it:=it-1;
- end;
- procedure TForm4.FormKeyPress(Sender: TObject; var Key: Char);
- begin
- if (Key=#113) or (Key=#81) then
- Close;
- end;
- procedure TForm4.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;
- end.