u2.pas
资源名称:辩论赛计时器.rar [点击查看]
上传用户:pegasus
上传日期:2013-04-14
资源大小:3825k
文件大小:8k
源码类别:
教育系统应用
开发平台:
Delphi
- {****************************************************************** }
- { 第二阶段-相互攻辩阶段 }
- { }
- {****************************************************************** }
- unit u2;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, StdCtrls, ExtCtrls, Buttons, jpeg;
- type
- TForm2 = class(TForm)
- Label2: TLabel;
- gbZh: TGroupBox;
- gbF: TGroupBox;
- sbtnZh: TSpeedButton;
- sbtnF: TSpeedButton;
- ZhLeftTime: TLabel;
- lbZh: TLabel;
- lbF: TLabel;
- FLeftTime: TLabel;
- timerZh: TTimer;
- TimerF: TTimer;
- Image1: TImage;
- procedure sbtnFClick(Sender: TObject);
- procedure timerZhTimer(Sender: TObject);
- procedure sbtnZhClick(Sender: TObject);
- procedure TimerFTimer(Sender: TObject);
- procedure FormKeyPress(Sender: TObject; var Key: Char);
- procedure FormCreate(Sender: TObject);
- private
- { Private declarations }
- it :integer;
- IsLongTime:Boolean;//长时间
- { Public declarations }
- procedure StopZh;
- procedure StopF;
- procedure StartZh;
- procedure StartF;
- procedure StartFLockZh;
- procedure StartZhLockF;
- procedure EnableZh;
- procedure EnableF;
- end;
- var
- Form2: TForm2;
- implementation
- uses
- uMain;
- const
- // STM:integer=30;
- // LTM:integer=90;
- STM:integer=300;
- LTM:integer=900;
- {$R *.dfm}
- ///////////////////////////////////////////////////
- ////反方计时
- // 通过 按钮 的 Tig 属性来区别第几次单击按钮
- ////////////////////////////////////////////////
- procedure TForm2.sbtnFClick(Sender: TObject);
- procedure Timing( btnZhCaption:String;tag:integer;t:integer);
- begin
- if sbtnF.Caption = '停止计时' then
- begin
- sbtnF.Tag:=tag;
- EnableZh;
- StopF;
- end
- else
- begin
- StartF;
- if btnZhCaption <> 'NoChange' then sbtnZh.Caption:=btnZhCaption;
- it :=t;
- EnableF;
- sbtnF.Caption := '停止计时';
- end;
- end;
- begin
- sbtnZh.Enabled:=True;
- sbtnF.Enabled:=False;
- case sbtnF.Tag of
- 0: //21,22,23 反方二辩提问
- begin
- Timing('正方回答',21,STM);
- end;
- 21:
- begin
- Timing('正方回答',22,STM);
- end;
- 22:
- begin
- Timing('正方回答',31,STM);
- end;
- //21,22,23 反方三辩提问
- 31:
- begin
- Timing('正方回答',32,STM);
- end;
- 32:
- begin
- Timing('正方回答',33,STM);
- end;
- 33:
- begin
- Timing('正方回答',34,STM);
- end;
- 34:
- begin
- sbtnF.Tag:=35;
- it:=LTM; //反方二辩或三辩提问90秒 ????????????
- StartFLockZh;
- sbtnF.Caption:='停止计时';
- sbtnZh.Caption:='正方做答辩小结';
- sbtnZh.Enabled:=False;
- sbtnF.Enabled:=True;
- end;
- 35:
- begin
- sbtnF.Tag:=36;
- StopF;
- end;
- /////////////////////////////////////////////////////////////////////
- ////以下反方回答
- //////////////////////////////////////////////////////////////////////
- 36:
- begin
- Timing('正方二辩第二次提问',42,STM);
- end;
- 42:
- begin
- Timing('正方二辩第三次提问',43,STM);
- end;
- 43:
- begin
- Timing('正方三辩第一次提问',44,STM);
- end;
- 44:
- begin
- Timing('正方三辩第二次提问',45,STM);
- end;
- 45:
- begin
- Timing('正方三辩第三次提问',46,STM);
- end;
- 46:
- begin
- Timing('正方做提问小结',132,STM);
- end;
- 132:
- begin
- Timing('NoChange',133,LTM);
- sbtnZh.Enabled:=False;
- end;
- end;
- end;
- ///////////////////////////////////////////////////
- ////正方计时
- //
- ////////////////////////////////////////////////
- procedure TForm2.sbtnZhClick(Sender: TObject);
- procedure Timing( btnFCaption:String;tag:integer;t:integer);
- begin
- if sbtnZh.Caption = '停止计时' then
- begin
- sbtnZh.Tag:=tag;
- EnableF;
- StopZh;
- end
- else
- begin
- StartZh;
- if btnFCaption <> 'NoChange' then sbtnF.Caption:=btnFCaption;
- it :=t;
- EnableZh;
- sbtnZh.Caption := '停止计时';
- end;
- end;
- begin
- sbtnZh.Enabled:=False;
- sbtnF.Enabled:=True;
- case sbtnZh.Tag of
- 0:
- begin
- Timing('反方二辩第二次提问',21,STM);
- end;
- 21:
- begin
- Timing('反方二辩第三次提问',22,STM);
- end;
- 22:
- begin
- Timing('反方三辩第一次提问',23,STM);
- end;
- 23:
- begin
- Timing('反方三辩第二次提问',24,STM);
- end;
- 24:
- begin
- Timing('反方三辩第三次提问',32,STM);
- end;
- 32:
- begin
- sbtnZh.Tag:=33;
- it:=STM;
- sbtnF.Caption:='反方做提问小结';
- sbtnZh.Caption:='停止计时';
- sbtnZh.Enabled:=True;
- sbtnF.Enabled:=False;
- StartZhLockF;
- end;
- 33:
- begin
- sbtnZh.Tag:=34;
- StopZh;
- ISLongTime:=True;
- end;
- 34:
- begin
- sbtnZh.Tag:=35;
- sbtnZh.Caption:='停止计时';
- sbtnZh.Enabled:=True;
- sbtnF.Enabled:=False; //正方做答辩小结计时';
- it:=LTM;
- StartZhLockF;
- end;
- 35:
- begin
- sbtnZh.Tag:=36;
- sbtnZh.Caption:='正方二辩第一次提问 ';
- sbtnZh.Width:=320;
- sbtnF.Caption:='反方回答';
- StopZh;
- IsLongTime:=False;
- sbtnZh.Enabled:=True;
- sbtnF.Enabled:=False;
- end;
- /////////////////////////////////////////////////////////////////////
- ////以下正方提问
- //////////////////////////////////////////////////////////////////////
- 36:
- begin
- Timing('反方回答',41,STM);
- end;
- 41:
- begin
- Timing('反方回答',42,STM);
- end;
- 42:
- begin
- Timing('反方回答',43,STM);
- end;
- 43:
- begin
- Timing('反方回答',44,STM);
- end;
- 44:
- begin
- Timing('反方回答',45,STM);
- end;
- 45:
- begin
- Timing('反方回答',133,STM);
- end;
- 133:
- begin
- sbtnZh.Tag:=134;
- IsLongTime:=True;
- it:=LTM;
- sbtnF.Caption:= '反方做答辩小结';
- sbtnZh.Caption:='停止计时';
- StartZhLockF;
- sbtnZh.Enabled:=True;
- sbtnF.Enabled:=False;
- end;
- 134:
- begin
- sbtnZh.Tag:=135;
- stopZh;
- end;
- end;
- end;
- procedure TForm2.timerZhTimer(Sender: TObject);
- begin
- if IsLongTime then
- begin
- if it=300 then beep1;
- end;
- ZhleftTime.Caption:=IntToTime (it);
- if it=0 then uMain.beep2;
- it:=it-1;
- end;
- procedure TForm2.TimerFTimer(Sender: TObject);
- begin
- if IsLongTime then
- begin
- if it=300 then beep1;
- end;
- FleftTime.Caption:=IntToTime (it);
- if it=0 then uMain.beep2;
- it:=it-1;
- end;
- procedure TForm2.StartF;
- begin
- TimerF.Enabled:=True;
- end;
- procedure TForm2.StartZh;
- begin
- TimerZh.Enabled:=True;
- end;
- procedure TForm2.StopF;
- begin
- TimerF.Enabled:=False;
- end;
- procedure TForm2.StopZh;
- begin
- TimerZh.Enabled:=False;
- end;
- procedure TForm2.EnableZh;
- begin
- sbtnZh.Enabled:=True;
- sbtnF.Enabled:=False;
- end;
- procedure TForm2.EnableF;
- begin
- sbtnZh.Enabled:=False;
- sbtnF.Enabled:=True;
- end;
- procedure TForm2.StartFLockZh;
- begin
- TimerF.Enabled:=True;
- TimerZh.Enabled:=False;
- end;
- procedure TForm2.StartZhLockF;
- begin
- TimerZh.Enabled:=True;
- TimerF.Enabled:=False;
- end;
- procedure TForm2.FormKeyPress(Sender: TObject; var Key: Char);
- begin
- if (Key=#113) or (Key=#81) then
- Close;
- end;
- procedure TForm2.FormCreate(Sender: TObject);
- begin
- IsLongTime:=False;
- 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.