unit Ustrasse;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ExtCtrls;

type
  TSrasse = class(TForm)
    Zeichnen: TButton;
    Beenden: TButton;
    Button1: TButton;
    Image1: TImage;
    PaintBox1: TPaintBox;
    Button2: TButton;
    Button3: TButton;
    procedure BeendenClick(Sender: TObject);
    procedure ZeichnenClick(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);

  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Srasse: TSrasse;

implementation

{$R *.DFM}
procedure pause(zeit:integer);
var anfang:integer;
begin
anfang:= gettickcount;
while anfang+zeit > gettickcount do
application.processmessages;
end;

procedure TSrasse.BeendenClick(Sender: TObject);
begin
close;
end;

procedure TSrasse.ZeichnenClick(Sender: TObject);
begin
with image1.canvas do begin
rectangle (100,250,250,100); {Hausrechteck}
moveto (100,100);
lineto(175,50);              {Dach}
lineto(250,100);              {Dach}
rectangle(120,150,150,110);   {Fenster links}
rectangle(200,150,230,110);   {Fenster rechts}
moveto(160,250);
lineto(160,200);              {Haustuer}
lineto(190,200);
lineto(190,250);
moveto(0,300);
lineto(image1.width,300);     {Straße}
moveto(0,400);
lineto(image1.width,400);
rectangle(470,250,520,90); {Kirchturm}
moveto(520,90);
lineto(495,20);
lineto(470,90);
moveto (480,250);  {Kirchtumtuer}
lineto(480,200);
lineto(510,200);
lineto(510,250);
arc(480,215,510,185,510,200,480,200);
ellipse(480,110,510,140);  {Turmuhr}
moveto(495,113);
lineto(495,125);
lineto(488,125);
moveto(520,170);   {Seitenschiff}
lineto(620,170);
lineto(620,250);
lineto(520,250);
rectangle(530,180,540,200);
rectangle(550,180,560,200);
rectangle(570,180,580,200);
rectangle(590,180,600,200);
moveto(620,170);
lineto(600,150);
lineto(520,150);
end;
end;

procedure TSrasse.Button1Click(Sender: TObject);
begin
paintbox1.canvas.moveto(-100,60);  //falls nur quer durchfahren, ohne But1
while paintbox1.canvas.penpos.x< paintbox1.width do begin
paintbox1.refresh;
messagebeep(2);
with paintbox1.canvas do begin
moveto(penpos.x+10,penpos.y);
lineto(penpos.x,penpos.y-40);
lineto(penpos.x+50,penpos.y);
lineto(penpos.x+30,penpos.y+25);
lineto(penpos.x+20,penpos.y);
lineto(penpos.x,penpos.y+15);
lineto(penpos.x-5,penpos.y);
ellipse(penpos.x-20,penpos.y-10,penpos.x,penpos.y+10);//weder innerhalb noch
moveto(penpos.x-20,penpos.y);                         //nach der Ellipse erfolgt
lineto(penpos.x-50,penpos.y);                         //Penverschiebung!
ellipse(penpos.x-20,penpos.y-10,penpos.x,penpos.y+10);
moveto(penpos.x-20,penpos.y);
lineto(penpos.x-5,penpos.y);
sleep(10);
end;
end;
end;


procedure TSrasse.Button2Click(Sender: TObject);  {Mittellinie}
begin
with image1.canvas do begin
 moveto(0,345);
while penpos.x < image1.width - 20 do
      begin
      rectangle(penpos.x,penpos.y,penpos.x+20,penpos.y+10);
      moveto(penpos.x+30,penpos.y);
      pause(50);
      end;
end;
end;

procedure TSrasse.Button3Click(Sender: TObject);  {Jägerzaun}
begin
with image1.canvas do begin
 moveto(0,250);  
while penpos.x < image1.width -20 do
      begin
      lineto (penpos.x+20,penpos.y+40);
      moveto (penpos.x,penpos.y-40);
      lineto (penpos.x-20,penpos.y+40);
      moveto (penpos.x+10,penpos.y-40);
      pause(50);
      end;
end;
end;

end.
