AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren

ampel programmieren

Ein Thema von nastytrouble · begonnen am 29. Mär 2006 · letzter Beitrag vom 19. Mär 2009
Antwort Antwort
Homer S.

Registriert seit: 18. Mär 2009
5 Beiträge
 
#1

Re: ampel programmieren

  Alt 19. Mär 2009, 09:17
Hallo zusammen,
Es handelt sich um Delphi 5!!!
ich habe hier eine Ampelkreuzung mit 2 Ampeln dies klappt soweit.
Ich bitte um eure hilfe, wie ich das auf 4 Ampeln mit Autos erweitere.
Außerdem sollten die Ampeln wie in echt schalten .
Bitte beachtet das ich ein anfänger bin .
Poste einfach mal den Quelltext:
Delphi-Quellcode:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Shape1: TShape;
    Shape2: TShape;
    shpRed1: TShape;
    shpYellow1: TShape;
    shpGreen1: TShape;
    shpYellow2: TShape;
    shpRed2: TShape;
    shpGreen2: TShape;
    Shape9: TShape;
    Shape10: TShape;
    Shape11: TShape;
    Shape12: TShape;
    Shape13: TShape;
    Shape14: TShape;
    Shape15: TShape;
    Shape16: TShape;
    Shape17: TShape;
    Shape18: TShape;
    Shape19: TShape;
    Shape20: TShape;
    Shape21: TShape;
    Shape22: TShape;
    Shape23: TShape;
    Shape24: TShape;
    Shape25: TShape;
    Shape26: TShape;
    Shape27: TShape;
    Shape28: TShape;
    Shape29: TShape;
    Shape30: TShape;
    Shape32: TShape;
    Shape33: TShape;
    Shape34: TShape;
    Shape35: TShape;
    Shape36: TShape;
    Shape37: TShape;
    Shape38: TShape;
    Shape39: TShape;
    Shape31: TShape;
    Shape40: TShape;
    Shape41: TShape;
    Shape42: TShape;
    Shape43: TShape;
    Shape44: TShape;
    Shape45: TShape;
    Shape46: TShape;
    Shape47: TShape;
    Shape48: TShape;
    Shape49: TShape;
    Shape50: TShape;
    Shape51: TShape;
    Shape52: TShape;
    Shape53: TShape;
    Shape54: TShape;
    Shape55: TShape;
    Shape56: TShape;
    Shape57: TShape;
    Shape59: TShape;
    Shape60: TShape;
    Shape61: TShape;
    Shape62: TShape;
    Shape63: TShape;
    Shape64: TShape;
    Shape65: TShape;
    Shape66: TShape;
    Shape67: TShape;
    Shape68: TShape;
    Button1: TButton;
    Timer1: TTimer;
    procedure shpRed2MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    procedure Timer1Timer(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.shpRed2MouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  Close;
end;

procedure TForm1.Timer1Timer(Sender: TObject);

begin
   if shpGreen2.Brush.Color = clblack then
   begin
   Timer1.interval := 3000;
   shpRed2.Brush.Color := clred;
   shpYellow2.Brush.Color := clblack;
   shpGreen2.Brush.Color := clnone;
   shpRed1.Brush.Color := clred;
   shpYellow1.Brush.Color := clblack;
   shpGreen1.Brush.Color := clnone;
    end
   else if shpYellow2.Brush.Color = clblack then
   begin
   Timer1.interval := 3000;
   shpRed2.Brush.Color := clred;
   shpYellow2.Brush.Color := clyellow;
   shpGreen2.Brush.Color := clnone;
   shpRed1.Brush.Color := clred;
   shpYellow1.Brush.Color := clyellow;
   shpGreen1.Brush.Color := clnone;
    end
   else if shpRed2.Brush.Color = clred then
   begin
   Timer1.interval := 3000;
   shpRed2.Brush.Color := clnone;
   shpYellow2.Brush.Color := clnone;
   shpGreen2.Brush.Color := cllime;
   shpRed1.Brush.Color := clnone;
   shpYellow1.Brush.Color := clnone;
   shpGreen1.Brush.Color := cllime;
   end
   else if shpGreen2.Brush.Color = cllime then
      begin
      Timer1.interval := 3000;
      shpRed2.Brush.Color := clblack;
      shpYellow2.Brush.Color := clyellow;
      shpGreen2.Brush.Color := clblack;
      shpRed1.Brush.Color := clblack;
      shpYellow1.Brush.Color := clyellow;
      shpGreen1.Brush.Color := clblack;
      end
    end;
    end.
  Mit Zitat antworten Zitat
Antwort Antwort

Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 17:54 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz