05.04.2009, 18:04
|
|
Гуру
|
|
Регистрация: 09.03.2009
Адрес: На курорте, из окна вижу теплое Баренцево море. Бррр.
Сообщения: 4,721
Репутация: 52347
|
|
Я такое делал, только у меня в обратную сторону к 00:00:00 считало, для вас адаптировал:
Код:
unit Unit10;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm10 = class(TForm)
Timer1: TTimer;
Label1: TLabel;
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
LeftSeconds: Integer;
public
{ Public declarations }
end;
var
Form10: TForm10;
implementation
{$R *.dfm}
procedure TForm10.FormCreate(Sender: TObject);
begin
LeftSeconds := 3600*24-5;
end;
procedure TForm10.Timer1Timer(Sender: TObject);
Var H, M, S: String;
T: Integer;
begin
T := LeftSeconds;
H := IntToStr(T div 3600);
Dec(T, T div 3600 * 3600);
M := IntToStr(T div 60);
Dec(T, T div 60 * 60);
S := IntToStr(T mod 60);
if Length(H) = 1 then H := '0'+ H;
if Length(M) = 1 then M := '0'+ M;
if Length(S) = 1 then S := '0'+ S;
Label1.Caption := H + ':' + M + ':' + S;
Inc(LeftSeconds);
end;
Код:
object Form10: TForm10
Left = 0
Top = 0
Caption = 'Form10'
ClientHeight = 137
ClientWidth = 406
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 128
Top = 40
Width = 146
Height = 45
Caption = '00:00:00'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -37
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
end
object Timer1: TTimer
Interval = 5
OnTimer = Timer1Timer
Left = 80
Top = 8
end
end
__________________
Жизнь такова какова она есть и больше никакова.
Помогаю за спасибо.
|