unit Unit1;
{ Basis }
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, jpeg, abfrage, unit2, unit3;
type
TForm1 =
class(TForm)
ImBild: TImage;
Button1: TButton;
Button2: TButton;
Button3: TButton;
ButtonHausErstellen: TButton;
ButtonHausLoeschen: TButton;
ComboBox1: TComboBox;
Button4: TButton;
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure ButtonHausErstellenClick(Sender: TObject);
procedure ButtonHausLoeschenClick(Sender: TObject);
private
{ Private-Deklarationen }
abfragefenster: tabfragefenster;
//haus: thaus;
procedure strassezeichnen;
public
i: integer;
haus:
array [1..20]
of thaus
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
ImBild.Canvas.Rectangle(0,0,ImBild.Width,ImBild.Height);
{Hierdurch wird das gesamte Rechteck weiß ausgefüllt}
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
form1.close
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
with ImBild.Canvas
do begin
Moveto (0,90);
StrasseZeichnen;
end
end;
procedure TForm1.StrasseZeichnen;
begin
with ImBild.Canvas
do begin
Pen.Width := 2;
lineto (Round(ImBild.Width/3),PenPos.Y);
lineto (Round(ImBild.Width*2/3+20),ImBild.Height);
moveto (PenPos.X+80,ImBild.Height);
lineto (Round(ImBild.Width/3)+30,90);
lineto (ImBild.Width,PenPos.Y);
moveto(0,PenPos.Y-40);
lineto (ImBild.Width,PenPos.Y);
moveto (0,50+20);
While PenPos.X <= ImBild.Width
do begin
moveto (PenPos.X+13,PenPos.Y);
lineto (PenPos.X+5,PenPos.Y);
end;
Pen.Width := 1
end;
end;
procedure TForm1.ButtonHausErstellenClick(Sender: TObject);
begin
i := i+1;
combobox1.items.add(inttostr(i));
Abfragefenster := tAbfragefenster.create(form1);
Abfragefenster.showmodal;
if Abfragefenster.zahlxko >=0
then begin
haus[i] := Thaus.create(Abfragefenster.zahlxko, Abfragefenster.zahlyko,
Abfragefenster.zahlbreite, Abfragefenster.dach,
Abfragefenster.wand, Abfragefenster.fenster, form1, imbild.canvas);
end;
Abfragefenster.Destroy;
end;
procedure TForm1.ButtonHausLoeschenClick(Sender: TObject);
begin
i := strtoint(combobox1.text);
haus[i].Destroy;
if components[componentcount-1]
is thaus
then haus[i] := thaus(components[componentcount-1]);
i := i-1;
end;
end.