找传奇、传世资源到传世资源站!

LED风格倒计时定时器

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

【例子介绍】

【相关图片】

LED风格倒计时定时器 Delphi数据库编程-第1张

【源码结构】

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, RzBorder, Menus, MMSystem, ExtCtrls;

type
  TFrmMain = class(TForm)
    RzLED: TRzLEDDisplay;
    tmr: TTimer;
    PopupMenu1: TPopupMenu;
    N1: TMenuItem;
    N5: TMenuItem;
    N4: TMenuItem;
    N3: TMenuItem;
    N2: TMenuItem;
    procedure FormCreate(Sender: TObject);
    procedure tmrTimer(Sender: TObject);
    procedure N1Click(Sender: TObject);
    procedure RzLEDDblClick(Sender: TObject);
    procedure N4Click(Sender: TObject);
    procedure PlayWave(wavename:string);
    procedure N3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FrmMain: TFrmMain;
  H,S,F:string;
  HF,SF:boolean;
implementation
uses unit2;
{$R *.dfm}

procedure TFrmMain.FormCreate(Sender: TObject);
begin
  H:='00';F:=':';S:='00';
  RzLED.Caption :=H F S;
end;

procedure TFrmMain.PlayWave(wavename:string);
begin
 wavename:= ExtractFilePath(Application.Exename) '\wave\' wavename;
 PlaySound(PChar(wavename),0,0);
end;

procedure TFrmMain.tmrTimer(Sender: TObject);
var
  mm,ss:Integer;
  Led:string;
begin
 try
   Led:=RzLED.Caption ;
      mm:=StrToInt(Copy(Led,1,2));
      ss:=StrToInt(Copy(Led,4,2));
      ss:=ss-1;
      if ss<0  then
       begin
         mm:=mm-1;
         ss:=59;
       end;
     if ss<10  then
        S:='0' IntToStr(ss)
     else
        S:=IntToStr(ss);
     if mm<10  then
        H:='0' IntToStr(mm)
     else
        H:=IntToStr(mm);
    if( H='00') and (S='00') then
       begin
         RzLED.Caption:='END ';
         PlayWave('11.wav');
         PlayWave('end.wav');
         tmr.Enabled :=False;
       end
    else
      begin
        RzLED.Caption :=H F S;
      end;
    if( H='02') and (S='00') then
      begin
         PlayWave('11.wav');
         RzLED.SegOnColor:=clyellow;
      end;
    if( H='01') and (S='00') then
      begin
         PlayWave('11.wav');
         PlayWave('1.wav');
         RzLED.SegOnColor:=clred;
      end;
 except
    begin
      showmessage('设置时间错误。');
      tmr.Enabled :=False;
      H:='00';
      F:=':';
      S:='00';
      RzLED.Caption :=H F S;
    end;
 end;          
end;

procedure TFrmMain.N1Click(Sender: TObject);
begin
 if( H='00') and (S='00') then
   begin
     showmessage('请设置时间。');
   end
 else
   begin
     PlayWave('Email.wav');
     tmr.Enabled :=True;
   end;
end;

procedure TFrmMain.RzLEDDblClick(Sender: TObject);
begin
if RzLED.Caption=' END' then RzLED.Caption :='00:00';
    tmr.Enabled:=not tmr.Enabled ;
    PlayWave('Email.wav');
end;

procedure TFrmMain.N4Click(Sender: TObject);
begin
close;
end;

procedure TFrmMain.N3Click(Sender: TObject);
begin
  Application.CreateForm(TFrmset, Frmset);
  Frmset.ShowModal;
end;

end.

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复