unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, dateUtils;
type
TForm1 = class(TForm)
Timer1: TTimer;
Label1: TLabel;
Label2: TLabel;
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
begin
Time: TDateTime;
endTime: TDateTime;
public
procedure begin
Test;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.begin
Test;
begin
begin
Time := Now;
endTime := IncHour(begin
Time, 1);
Timer1.Interval := 200;
Timer1.Enabled := true;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
begin
Test;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
s: string;
i: integer;
time_now: TDateTime;
begin
time_now := now;
s := FormatDateTime('hh:nn:ss', endTime - time_now);
Label1.Caption := s;
i := SecondsBetween(time_now, endTime);
Label2.Caption := Format('剩余 %d 秒', );
end;
end.