unit Unit1;
interface
uses
Winapi.Windows,
Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs,
Vcl.StdCtrls,
Vcl.ExtCtrls,
Vcl.Imaging.pngimage;
type
TForm1 =
class(TForm)
Timer1: TTimer;
Timer2: TTimer;
Timer3: TTimer;
Image1: TImage;
Image2: TImage;
Image3: TImage;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
procedure Timer3Timer(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
Timer1.Enabled := True;
Timer2.Enabled := True;
Timer3.Enabled := True;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
randomize;
Image1.Left := image1.Left + random(10) + 1;
Timer1.Interval := 1 + random(100);
if Image1.Left <= Form1.Width - 2 * image1.Width
then
Timer1.Enabled := True
else
Timer1.Enabled := False;
end;
procedure TForm1.Timer2Timer(Sender: TObject);
begin
randomize;
Image2.Left := image2.Left + random(10) + 1;
Timer2.Interval := 1 + random(100);
if Image2.Left <= Form1.Width - 2 * image2.Width
then
Timer2.Enabled := True
else
Timer2.Enabled := False;
end;
procedure TForm1.Timer3Timer(Sender: TObject);
begin
randomize;
Image3.Left := image3.Left + random(10) + 1;
Timer3.Interval := 1 + random(100);
if Image3.Left <= Form1.Width - 2 * image3.Width
then
Timer3.Enabled := True
else
Timer3.Enabled := False;
end;
end.