RSS订阅 | 匿名投稿
您的位置:网站首页 > 时间 > 正文

delphi 倒计时源码

作者:admin 来源:未知 日期:2010/4/28 22:39:35 人气: 标签:倒计时

代码:

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, strUtils, jpeg, dateutils,shellapi;

type
TForm1 = class(TForm)
tmr1: TTimer;
lbl1: TLabel;
lbl3: TLabel;
lbl2: TLabel;
lbl4: TLabel;
lbl5: TLabel;
lblD: TLabel;
lblH: TLabel;
lblM: TLabel;
lblS: TLabel;
img1: TImage;
lbl13: TLabel;
Label1: TLabel;
lbl6: TLabel;
lbl7: TLabel;
procedure tmr1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure img1Click(Sender: TObject);
procedure lbl6Click(Sender: TObject);
procedure lbl7Click(Sender: TObject);


private
{ Private declarations }
public
{ Public declarations }

end;

var
Form1: TForm1;
OpeningCeremony: string = '2010-08-09 20:00:00';

implementation

{$R *.dfm}

procedure TForm1.tmr1Timer(Sender: TObject);
var
t1, t2: TDateTime;
dddd, hhhh, nnnn, ssss: Real;
begin
t1 := StrToDateTime(DateTimeToStr(now));
t2 := StrToDateTime(OpeningCeremony);
dddd := (t2 - t1);
hhhh := (dddd - Int(dddd)) * 24;
nnnn := (hhhh - Int(hhhh)) * 60;
ssss := (nnnn - Int(nnnn)) * 60;

Form1.Caption := '***运动会开幕式倒计时' + DupeString(#32, 40) + formatDateTime('yyyy' + '年' + 'mm' + '月' + 'dd' + '日' + 'hh' + '时' + 'nn' + '分' + 'ss' + '秒', t1);
lblD.Caption := vartostr(Int(dddd));
if Int(hhhh) < 10 then
lblH.Caption := '0' + vartostr(int(hhhh))
else
lblH.Caption := vartostr(int(hhhh));

if Int(nnnn) < 10 then
lblM.Caption := '0' + vartostr(Int(nnnn))
else
lblM.Caption := vartostr(Int(nnnn));

if 60 - StrToInt(formatDateTime('ss', t1)) < 10 then
lblS.Caption := '0' + vartostr(60 - StrToInt(formatDateTime('ss', t1)))
else
lblS.Caption := vartostr(60 - StrToInt(formatDateTime('ss', t1)));
end;


procedure TForm1.FormCreate(Sender: TObject);
begin
form1.AlphaBlend := true;
form1.AlphaBlendValue := 220;
end;

procedure TForm1.img1Click(Sender: TObject);
begin
ShellExecute(Handle,'open','http://www.3464.com/',nil,nil,SW_SHOWNORMAL)
end;

procedure TForm1.lbl6Click(Sender: TObject);
begin
ShellExecute(Handle,'open','http://www.3464.com/',nil,nil,SW_SHOWNORMAL)
end;

procedure TForm1.lbl7Click(Sender: TObject);
begin
ShellExecute(Handle,'open','http://www.3464.com/',nil,nil,SW_SHOWNORMAL)
end;

end.

读完这篇文章后,您心情如何?
0
0
0
0
0
0
0
0
本文网址: