unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 =
class(TForm)
Bt1: TButton;
Button2: TButton;
Btst1: TButton;
procedure Button2Click(Sender: TObject);
procedure create(Sender: TObject);
procedure Btst1Click(Sender: TObject);
procedure Bt1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
stop:integer;
i:Integer;
implementation
{$R *.dfm}
procedure TForm1.Bt1Click(Sender: TObject);
begin
if stop=0
then
begin
stop:=1;
end
else
begin
stop:=0;
end;
end;
procedure TForm1.Btst1Click(Sender: TObject);
begin
if stop=0
then
begin
stop:=1;
Btst1.Caption:=('
Schleife an');
end
else
begin
stop:=0;
Btst1.Caption:=('
Schleife aus');
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var xstart, ystart, xradius, yradius, aufloesung: Integer;
begin
repeat
ystart:=100;
xstart:=100;
yradius:=100;
xradius:=100;
aufloesung:=100;
bt1.Top:=round(ystart+xradius+(xradius*sin(i/aufloesung)));
bt1.Left:=round(xstart+yradius+(yradius*cos(i/aufloesung)));
Application.ProcessMessages;
sleep(2);
until Stop=1;
Application.ProcessMessages;
end;
procedure TForm1.create(Sender: TObject);
begin
stop:=0;
end;
end.