unit muehleU;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
const
pi=3.1415;
type
TForm1 =
class(TForm)
Button1: TButton;
Image1: TImage;
Edit1: TEdit;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Timer1: TTimer;
Button6: TButton;
procedure Button1Click(Sender: TObject);
procedure Muehle(anzahl,hoehe,x,y:integer);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
v:integer;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var z:integer;
begin
z:= StrToInt(Edit1.Text);
Muehle (z,150,50,50);
end;
procedure TForm1.Muehle (anzahl,hoehe,x,y:integer);
var flange,nr,x2,y2,FluegelEndeX,FluegelEndeY:integer;
begin
with Image1.Canvas
do
begin
moveTo (x,y);
rectangle (x,y,x+round(hoehe/5),hoehe);
moveTo (x+(round(hoehe/5)
DIV 2),y+10);
x2:= x+(round(hoehe/5)
DIV 2);
y2:= y+10;
flange:= hoehe
DIV 2 ;
for nr:= 1
to anzahl
do
begin
FluegelEndeX:= x2+round(flange*cos(nr*(2*pi+v)/anzahl));
FluegelEndeY:= y2+round(flange*sin(nr*(2*pi+v)/anzahl));
lineTo (FluegelEndeX,FluegelEndeY);
moveTo (x2,y2);
end;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Muehle (2,150,50,50);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
Muehle (8,150,50,50);
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
Muehle (20,150,50,50);
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
Muehle (150,150,50,50);
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Image1.Canvas.Pen.Color:= clBlack;
Muehle (8,150,50,50);
Image1.Canvas.Pen.Color:= clWhite;
Muehle (8,150,50,50);
Image1.Canvas.Pen.Color:= clBlack;
Muehle (8,150,50,50);
end;
procedure TForm1.Button6Click(Sender: TObject);
begin
Timer1.Enabled:= true;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
v:= 0
end;
end.