blikk info infothek forum galerie sitemap

Lösung 2 für Timer

anfang zurueck weiter ende nach oben
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Shape1: TShape;
    Shape2: TShape;
    Shape3: TShape;
    Shape4: TShape;
    Timer1: TTimer;
    Timer2: TTimer;
    Image1: TImage;
    Image2: TImage;
    Image3: TImage;
    Image4: TImage;
    Image5: TImage;
    Image6: TImage;
    Image7: TImage;
    Image8: TImage;
    Image9: TImage;
    Image10: TImage;
    Image11: TImage;
    Image12: TImage;
    Image13: TImage;
    Image14: TImage;
    Image15: TImage;
    Image16: TImage;
    Image17: TImage;
    Image18: TImage;
    Image19: TImage;
    Image20: TImage;
    bt: TButton;
    procedure Timer1Timer(Sender: TObject);
    procedure btClick(Sender: TObject);
    procedure Timer2Timer(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Timer1Timer(Sender: TObject);
begin
if image1.visible = true
then begin
     image1.visible:= false;
     image2.visible:= false;
     image3.visible:= false;
     image4.visible:= false;
     image5.visible:= true;
     image6.visible:= true;
     image7.visible:= true;
     image8.visible:= true;
     timer1.Interval := 500;
     end
else begin
     image1.visible:= true;
     image2.visible:= true;
     image3.visible:= true;
     image4.visible:= true;
     image5.visible:= false;
     image6.visible:= false;
     image7.visible:= false;
     image8.visible:= false;
     timer1.Interval := 500;
     end
end;

procedure TForm1.btClick(Sender: TObject);
begin
if bt.caption= 'AN'
then begin
     image1.visible:=true;
     image2.visible:=true;
     image3.visible:=true;
     image4.visible:=true;
     image10.visible:=true;
     image12.visible:=true;
     image13.visible:=true;
     image14.visible:=true;
     bt.caption:='AUS';
     timer1.enabled:=false;
     timer2.enabled:=true;
     end
else begin
     bt.caption:='AN';
     image1.visible:=true;
     image2.visible:=true;
     image3.visible:=true;
     image4.visible:=true;
     image5.visible:=false;
     image6.visible:=false;
     image7.visible:=false;
     image8.visible:=false;
     image9.visible:=false;
     image10.visible:=false;
     image11.visible:=false;
     image12.visible:=false;
     image13.visible:=false;
     image14.visible:=false;
     image15.visible:=false;
     image16.visible:=false;
     image17.visible:=false;
     image18.visible:=false;
     image19.visible:=false;
     image20.visible:=false;
     timer2.enabled:=false;
     timer1.enabled:=true;
     end;
end;

procedure TForm1.Timer2Timer(Sender: TObject);
begin
if image13.visible = true
then begin
     image13.visible:=false;
     image14.visible:=false;
     image10.visible:=false;
     image12.visible:=false;
     image17.visible:=true;
     image18.visible:=true;
     image8.visible:=true;
     image7.visible:=true;
     timer2.interval:= 1500;
     end
else begin if image17.visible=true
then begin
     image17.visible:=false;
     image18.visible:=false;
     image7.visible:=false;
     image8.visible:=false;
     image9.visible:=true;
     image11.visible:=true;
     image15.visible:=true;
     image16.visible:=true;
     timer2.interval:=3000;
     end
else begin if image9.visible=true
then begin
     image9.visible:=false;
     image11.visible:=false;
     image15.visible:=false;
     image16.visible:=false;
     image5.visible:=true;
     image6.visible:=true;
     image20.visible:=true;
     image19.visible:=true;
     timer2.interval:=1500;
     end
else begin if image5.visible=true
then begin
     image5.visible:=false;
     image6.visible:=false;
     image20.visible:=false;
     image19.visible:=false;
     image13.visible:=true;
     image14.visible:=true;
     image10.visible:=true;
     image12.visible:=true;
     timer2.interval:=3000;
     end
end
end
end
end;

end.
nach oben