u1.pas
资源名称:辩论赛计时器.rar [点击查看]
上传用户:pegasus
上传日期:2013-04-14
资源大小:3825k
文件大小:5k
源码类别:
教育系统应用
开发平台:
Delphi
- {****************************************************************** }
- { 第一阶段-开篇立论阶段 }
- { }
- {****************************************************************** }
- 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.