Claudio1996,
Cita:
Empezado por Claudio1996
...como puedo crear un contador de 5 segundos a 0 y despues que me abra otro form...
|
¡Bienvenido al Club Delphi!
Revisa este código:
Código Delphi
[-]
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
public
end;
var
Form1: TForm1;
Count : Integer;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
Timer1.Interval := 100;
Count := 5;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Timer1.Interval := 1000;
if (Count > 0) then
begin
Label1.Caption := IntToStr(Count);
Dec(Count);
end
else
begin
Timer1.Enabled := False;
Form2.Show;
end;
end;
end.
El código anterior en Delphi 7 sobre Windows 7 Professional x32,
Implementa un contador de 5 segundos para la salida de un formulario, como se muestra en la siguiente imagen:
Espero sea útil
Nelson.