09.05.2009, 13:12
Гуру
Регистрация: 09.03.2009
Адрес: На курорте, из окна вижу теплое Баренцево море. Бррр.
Сообщения: 4,723
Репутация: 52347
Элементарно, надо воспользоваться компонентом TTimer:
Код:
unit Unit22;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm22 = class(TForm)
Timer1: TTimer;
Label1: TLabel;
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
Counter: Integer;
end;
var
Form22: TForm22;
implementation
{$R *.dfm}
procedure TForm22.FormCreate(Sender: TObject);
begin
Counter := 10;
end;
procedure TForm22.Timer1Timer(Sender: TObject);
begin
Label1.Caption := IntToStr(Counter);
Dec(Counter);
if Counter < -1 then Application.Terminate;
end;
end.
DFM
Код:
object Form22: TForm22
Left = 0
Top = 0
Caption = 'Form22'
ClientHeight = 302
ClientWidth = 635
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 = 56
Top = 24
Width = 7
Height = 25
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -21
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
end
object Timer1: TTimer
OnTimer = Timer1Timer
Left = 16
Top = 16
end
end
__________________
Жизнь такова какова она есть и больше никакова.
Помогаю за спасибо.