unit Fahrstuhl;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls, jpeg, RackCtls;
type
TForm1 =
class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Image1: TImage;
Timer1: TTimer;
Button8: TButton;
Button9: TButton;
Button10: TButton;
Button11: TButton;
Button12: TButton;
Button13: TButton;
Button14: TButton;
Image2: TImage;
Image3: TImage;
Label1: TLabel;
Image4: TImage;
Timer12: TTimer;
Image5: TImage;
procedure Timer1Timer(Sender: TObject);
procedure Button14Click(Sender: TObject);
procedure Button8Click(Sender: TObject);
procedure Timer12Timer(Sender: TObject);
procedure Button9Click(Sender: TObject);
procedure Button10Click(Sender: TObject);
procedure Button11Click(Sender: TObject);
procedure Button12Click(Sender: TObject);
procedure Button13Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
z: integer;
implementation
{$R *.DFM}
procedure TForm1.Timer1Timer(Sender: TObject);
var
x : integer;
y : integer;
begin
y:=2;
x:=-2;
if image1.top>z
then //muss runterfahren
Image1.top:=Image1.top+x;
//bild fahrstuhl
if image1.top<z
then //muss rauffahren
Image1.top:=Image1.top-x;
if image4.top>z
then //muss runterfahren
Image4.top:=Image1.top+x;
//bild Tür
if image4.top<z
then //muss rauffahren
Image4.top:=Image1.top-x;
if image5.top>z
then //muss runterfahren
Image5.top:=Image1.top+x;
//bild kehäuse
if image5.top<z
then //muss rauffahren
Image5.top:=Image1.top-x;
if image4.top=z
then
Image4.left:=Image4.left-y;
//tür auf
if image4.left=30
then //tür offen ende des timer
timer1.enabled:=false;
if image1.top=120
then
Label1.caption:=inttostr(4);
if image1.top=0
then
Label1.caption:=inttostr(5);
// fahrstuhl posi anzeige
if image1.top=240
then
Label1.caption:=inttostr(3);
if image1.top=360
then
Label1.caption:=inttostr(2);
if image1.top=480
then
Label1.caption:=inttostr(1);
if image1.top=600
then
Label1.caption:=inttostr(0);
end;
procedure TForm1.Button14Click(Sender: TObject);
begin
close;
end;
procedure TForm1.Button8Click(Sender: TObject);
// Fahrstuhlknopf innen EG
begin
timer12.enabled:=true;
z:=600;
end;
procedure TForm1.Timer12Timer(Sender: TObject);
// tür zu
var
y : integer;
begin
timer12.enabled:=true;
y:=2;
Image4.left:=Image4.left+y;
if image4.left=100
then
timer12.enabled:=false;
if timer12.enabled=false
then
timer1.enabled:=true;
end;
procedure TForm1.Button9Click(Sender: TObject);
begin
timer12.enabled:=true;
z:=480;
end;
procedure TForm1.Button10Click(Sender: TObject);
begin
timer12.enabled:=true;
z:=360;
end;
procedure TForm1.Button11Click(Sender: TObject);
begin
timer12.enabled:=true;
z:=240;
end;
procedure TForm1.Button12Click(Sender: TObject);
begin
timer12.enabled:=true;
z:=120;
end;
procedure TForm1.Button13Click(Sender: TObject);
begin
timer12.enabled:=true;
z:=0;
end;
end.