Hola pape19.
Si no te entendí mal, podrías hacer algo como esto:
Ventana con cuenta regresiva:
Código Delphi
[-]
...
type
TForm2 = class(TForm)
Timer1: TTimer;
Label1: TLabel;
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
FCountDown: TTime;
public
property CountDown: TTime read FCountDown write FCountDown;
end;
var
Form2: TForm2;
implementation {$R *.dfm}
uses DateUtils;
procedure TForm2.FormCreate(Sender: TObject);
begin
BorderStyle:= bsNone;
WindowState:= wsMaximized;
Color:= clBlack;
Timer1.Enabled:= True;
with Label1 do
begin
Color:= clBlack;
Font.Name:= 'Verdana';
Font.Size:= 72;
Font.Color:= clLime;
Left:= (Screen.Width - Width) div 2;
Top:= (Screen.Height - Height) div 2;
end;
end;
procedure TForm2.Timer1Timer(Sender: TObject);
begin
FCountDown:= IncSecond(FCountDown, -1);
if FCountDown > 0 then
Label1.Caption:= FormatDateTime('hh:mm:ss', FCountDown)
else
begin
MessageBeep(MB_ICONEXCLAMATION);
Close;
end;
end;
procedure TForm2.FormDestroy(Sender: TObject);
begin
Timer1.Enabled:= False;
end;
end.
Llamada:
Código Delphi
[-]
...
implementation
uses Unit2;
procedure TForm1.btnDescansarClick(Sender: TObject);
begin
with TForm2.Create(nil) do
try
CountDown:= StrToTime('00:01:00'); ShowModal;
finally
Free;
end;
end;
Saludos.