unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, ComCtrls;
type
TForm1 =
class(TForm)
lblMinuten: TLabel;
lblSekunden: TLabel;
btnStarten: TButton;
Timer1: TTimer;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Label1: TLabel;
Label2: TLabel;
StatusBar1: TStatusBar;
Timer2: TTimer;
procedure Timer2Timer(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure btnStartenClick(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
private
{ Private-Deklarationen }
public
procedure ScaleBy(M: Integer; D: Integer);
{ Public-Deklarationen }
end;
var
Form1: TForm1;
Minuten,
Sekunden : Integer;
implementation
{$R *.dfm}
procedure TForm1.ScaleBy(M: Integer; D: Integer);
begin
Form1.ScaleBy(200,100);
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Sekunden := Sekunden - 1;
lblSekunden.Caption := IntToStr(Sekunden);
if (Minuten = 0)
and (Sekunden = 0)
then
begin
timer1.Enabled := false;
MessageDlg('
Ihr eingegebener Countdown ist abgelaufen!', mtConfirmation,[mbOk], 0);
end
else if Sekunden < 0
then
begin
Sekunden := 59;
lblSekunden.Caption := IntToStr(Sekunden);
Minuten := Minuten - 1;
lblMinuten.Caption := IntToStr(Minuten);
end
else if (Minuten = 0)
and (Sekunden <= 10)
then
begin
lblSekunden.Font.Color := clRed;
end;
end;
procedure TForm1.btnStartenClick(Sender: TObject);
begin
if timer1.enabled = true
then
begin
btnStarten.Caption := '
Starten';
timer1.Enabled := false;
end
else
begin
btnStarten.Caption := '
Stoppen';
timer1.Enabled := true;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Minuten := Minuten + 1;
lblMinuten.Caption := IntToStr(Minuten);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
Minuten := Minuten - 1;
lblMinuten.Caption := IntToStr(Minuten);
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
if sekunden = 50
then
begin
minuten := minuten + 1;
lblminuten.caption := IntToStr(Minuten);
sekunden := 0;
lblsekunden.caption := IntToStr(Sekunden);
end
else if sekunden < 60
then
begin
Sekunden := Sekunden + 10;
lblSekunden.Caption := IntToStr(Sekunden);
end;
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
if sekunden = 0
then
begin
Minuten := Minuten - 1;
lblMinuten.caption := IntToStr(Minuten);
Sekunden := 50;
lblSekunden.caption := IntToStr(Sekunden);
end
else
begin
Sekunden := Sekunden - 10;
lblSekunden.Caption := IntToStr(Sekunden);
end;
end;
procedure TForm1.Timer2Timer(Sender: TObject);
begin
//Zeigt Zeit im 2. Panel der Statuszaeilte fortlaufend an
StatusBar1.Panels.Items[0].Text := '
Aktuelle Uhrzeit' + '
' + TimeToStr(Now);
end;
end.