Nun hab ich:
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
begin
if button1.caption='Lauf' then begin Timer1.enabled:=true; button1.Caption:='Lauf stop' end
else if (button1.caption='Lauf stop' )and (Timer1.enabled=true) then begin Timer1.enabled:=false;button1.caption:='Lauf' end
else if (button1.caption='Lauf stop') and (Timer2.enabled=true) then begin Timer2.enabled:=false;button1.caption:='Lauf' end
else if (button1.caption='Lauf stop') and (Timer3.enabled=true) then begin Timer3.enabled:=false;button1.caption:='Lauf' end
else if (button1.caption='Lauf stop') and (Timer4.enabled=true) then begin Timer4.enabled:=false;button1.caption:='Lauf' end
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
image1.left:=image1.Left+10; Timer1.Interval:=400;
if image1.left >= 50 then begin Timer2.enabled:=true; Timer1.enabled:=false end
end;
procedure TForm1.Timer2Timer(Sender: TObject);
begin
image1.top:=image1.Top+10; Timer2.Interval:=400;
if image1.Top = 50 then begin Timer3.enabled:=true; Timer2.enabled:=false end
end;
procedure TForm1.Timer3Timer(Sender: TObject);
begin
image1.left:=image1.left-10; Timer3.Interval:=400;
if image1.Left <= 0 then begin Timer3.enabled:=false; Timer4.Enabled:=true end
end;
procedure TForm1.Timer4Timer(Sender: TObject);
begin
image1.Top:=image1.Top-10; Timer3.Interval:=400;
if image1.Top = 0 then begin Timer4.Enabled:=false; Timer1.Enabled:=true end
end;
Das funktioniert schon besser, aber noch nich perfekt.
Könnt mir jemand sagen was noch fehlt, oder was falsch ist?
danke schonmal