Thema: Delphi ampel programmieren

Einzelnen Beitrag anzeigen

nastytrouble

Registriert seit: 16. Mär 2006
Ort: 23966 Wismar
42 Beiträge
 
Delphi 2007 Enterprise
 
#1

ampel programmieren

  Alt 29. Mär 2006, 06:47
kann mal jemand bei der ampel hier helfen?

Delphi-Quellcode:
unit ampel;

interface

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

type
  TForm1 = class(TForm)
    Shape1: TShape;
    sh_red: TShape;
    sh_yellow: TShape;
    sh_green: TShape;
    switch: TButton;
    procedure switchClick(Sender: TObject);
  private
    { Private-Deklarationen}
  public
    { Public-Deklarationen}
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

Procedure wait(Time:Integer);
  Var x:Dword;
Begin
  Time := Time * 20;
  x := GetTickCount ;
  While x - time < GetTickCount do Application.ProcessMessages;
End;

procedure TForm1.switchClick(Sender: TObject);
begin
  wait(3);
    sh_green.Visible := false;
    sh_yellow.Visible := true;
  wait(3);
    sh_yellow.Visible := false;
    sh_red.Visible := true;
  wait(3);
    sh_yellow.Visible := true;
  wait(3);
    sh_red.Visible := false;
    sh_yellow.Visible := false;
    sh_green.Visible := true;
end;
end.
Angehängte Dateien
Dateityp: zip ampel_538.zip (200,5 KB, 60x aufgerufen)
  Mit Zitat antworten Zitat