unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 =
class(TForm)
Button1: TButton;
PaintBox1: TPaintBox;
Edit1: TEdit;
Edit2: TEdit;
Label1: TLabel;
Label2: TLabel;
Button2: TButton;
Edit3: TEdit;
Edit4: TEdit;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
Tgeo_objects =
class
end;
Tpunkt =
class(Tgeo_objects)
x :integer;
y:integer;
procedure setx(r:integer);
procedure sety(z:integer);
end;
TLinie =
class(Tpunkt)
p1,p2:Tpunkt;
end;
TViereck =
class(TLinie)
protected
procedure zeichne;
end;
TDreieck =
class(Tviereck)
procedure Dreieckzeichnen;
end;
Tgeo_objectsArray =
Array of Tgeo_objects;
var
Form1: TForm1;
MyViereck : TViereck;
Punkt:Tpunkt;
r:integer;
z:integer;
GeoArray :Tgeo_objectsarray;
i :integer;
Mydreieck:Tdreieck;
implementation
procedure TViereck.zeichne;
begin
form1.PaintBox1.Canvas.MoveTo(myviereck.x,myviereck.y);
form1.paintbox1.canvas.LineTo(myviereck.x+100,myviereck.y);
form1.paintbox1.canvas.lineto(myviereck.x+100,myviereck.y+100);
form1.paintbox1.canvas.lineto(myviereck.x,myviereck.y+100);
form1.paintbox1.Canvas.MoveTo(myviereck.x,myviereck.y);
form1.PaintBox1.canvas.LineTo(myviereck.x,myviereck.y+100);
end;
procedure TPunkt.Setx(r:integer);
begin
x:=r;
end;
procedure TPunkt.sety(z:integer);
begin
y:=z;
end;
procedure TDreieck.Dreieckzeichnen;
begin
form1.PaintBox1.Canvas.MoveTo(mydreieck.x,mydreieck.y);
form1.PaintBox1.Canvas.LineTo(mydreieck.x+100,mydreieck.y);
form1.PaintBox1.Canvas.MoveTo(mydreieck.x,mydreieck.y);
form1.paintbox1.canvas.LineTo(mydreieck.x,mydreieck.y+100);
form1.paintbox1.Canvas.MoveTo(mydreieck.x,mydreieck.y+100);
form1.PaintBox1.Canvas.LineTo(mydreieck.x+100,mydreieck.y);
end;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
MyViereck := TViereck.Create;
r:= strtoint(edit1.text);
z:= strtoint(edit2.text);
myviereck.setx(r);
myviereck.sety(z);
MyViereck.zeichne;
MyViereck.Free;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
r := strtoint(edit3.text);
z := strtoint(edit4.text);
Mydreieck := Tdreieck.Create;
mydreieck.setx(r);
mydreieck.sety(z);
mydreieck.Dreieckzeichnen;
mydreieck.Free
end;
end.