delphi 倒计时源码


本文整理自网络,侵删。

 代码:

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.

相关阅读 >>

Delphi 通过读取注册表信息获取桌面路径

Delphi 字符串分割

Delphi android 拨打电话

Delphi d10.x 并行库ppl编程之ttask

Delphi mscomm1自动获取串口

Delphi 一个中英文记录Delphi实现

Delphi 仿dbnavigator方式

Delphi 基础计算两数之合

Delphi 静态调用dll和动态调用dll优缺点

Delphi 去掉文件只读属性

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...