u3.pas
Upload User: pegasus
Upload Date: 2013-04-14
Package Size: 3825k
Code Size: 3k
Development Platform:

Delphi

  1. {****************************************************************** }
  2. {              第三阶段-自由辩论阶段                                }
  3. {                                                                   }
  4. {****************************************************************** }
  5. unit u3;
  6. interface
  7. uses
  8.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  9.   Dialogs, ExtCtrls, Buttons, StdCtrls, jpeg;
  10. type
  11.   TForm3 = class(TForm)
  12.     Label3: TLabel;
  13.     gbZh: TGroupBox;
  14.     sbtnZhStart: TSpeedButton;
  15.     ZhLeftTime: TLabel;
  16.     gbF: TGroupBox;
  17.     sbtnFStart: TSpeedButton;
  18.     FLeftTime: TLabel;
  19.     timerZh: TTimer;
  20.     TimerF: TTimer;
  21.     lb: TLabel;
  22.     Image1: TImage;
  23.     lbZh: TLabel;
  24.     lbF: TLabel;
  25.     procedure timerZhTimer(Sender: TObject);
  26.     procedure TimerFTimer(Sender: TObject);
  27.     procedure sbtnZhStartClick(Sender: TObject);
  28.     procedure sbtnFStartClick(Sender: TObject);
  29.     procedure FormKeyPress(Sender: TObject; var Key: Char);
  30.     procedure FormCreate(Sender: TObject);
  31.   private
  32.     { Private declarations }
  33.      tZh :integer; //正方时间
  34.     tF :integer;  //反方时间
  35.   public
  36.     { Public declarations }
  37.   end;
  38. var
  39.   Form3: TForm3;
  40. implementation
  41. uses
  42.   uMain;
  43. {$R *.dfm}
  44. procedure TForm3.timerZhTimer(Sender: TObject);
  45. begin
  46.   ZhleftTime.Caption:=IntToTime(tZh);
  47.   if tZh=300 then
  48.   begin
  49.     beep1;
  50.   end;
  51.   if tZh=0 then
  52.   begin
  53.    uMain.beep2;
  54.    timerZh.Enabled:=False;
  55.    sbtnZhStart.Enabled:=False;
  56.   //  sbtnFStart.Enabled:=False;          //考虑到主席要说:“正方时间到 ”
  57.   // if tF>0 then    timerF.Enabled:=True; //注释掉此两行
  58.   end;
  59.   tZh:=tZh-1;
  60. end;
  61. procedure TForm3.TimerFTimer(Sender: TObject);
  62. begin
  63.   FleftTime.Caption:=IntToTime(tF);
  64.   if tF=300 then
  65.   begin
  66.     beep1;
  67.   end;
  68.   if tF=0 then
  69.   begin
  70.    uMain.beep2;
  71.    sbtnFStart.Enabled:=False;
  72.    timerF.Enabled:=False;
  73.   end;
  74.    tF:=tF-1;
  75. end;
  76. procedure TForm3.sbtnZhStartClick(Sender: TObject);
  77. begin
  78.    sbtnZhStart.Enabled:=False;
  79.    sbtnFStart.Enabled:=True;
  80.    timerZh.Enabled:=True;
  81.    timerF.Enabled:=False;
  82.    lb.Caption:='正 方 计 时 中';
  83.    lb.Font:=sbtnZhStart.Font;
  84.    lb.Font.Size:=28;
  85.    if tF<1  then  sbtnFStart.Enabled:=False;
  86. end;
  87. procedure TForm3.sbtnFStartClick(Sender: TObject);
  88. begin
  89.    sbtnZhStart.Enabled:=True;
  90.    sbtnFStart.Enabled:=False;
  91.    timerZh.Enabled:=False;
  92.    timerF.Enabled:=True;
  93.    lb.Caption:='反 方 计 时 中';
  94.        lb.Font:=sbtnFStart.Font;
  95.     lb.Font.Size:=28;
  96.    if tZh<1 then  sbtnZhStart.Enabled:=False;
  97. end;
  98. procedure TForm3.FormKeyPress(Sender: TObject; var Key: Char);
  99. begin
  100.   if (Key=#113) or (Key=#81) then
  101.     Close;
  102. end;
  103. procedure TForm3.FormCreate(Sender: TObject);
  104. begin
  105.    // tZh :=350; //正方时间
  106.    // tF :=350;  //反方时间
  107.   tZh :=3000; //正方时间
  108.   tF  :=3000;  //反方时间
  109.   lbZh.Font.Color:=uMain.ZhFontColor;
  110.   ZhLeftTime.Font.Color:= uMain.ZhFontColor;
  111.   lbF.Font.Color:=uMain.FFontColor;
  112.   FLeftTime.Font.Color:= uMain.FFontColor;
  113.   gbZh.Color:=uMain.ZhBackgroundColor;
  114.   gbF.Color:=uMain.FBackgroundColor;
  115. end;
  116. end.