|
Registriert seit: 15. Sep 2012 2 Beiträge |
#4
Edit: Ich möchte, dass sobald ein Button die richtige Caption (also die richtige Zahl [1-9]) hat, die Caption nicht mehr von den anderen Buttons geändert werden kann.
Ich gebe euch mal meinen Quellcode... ^^
Delphi-Quellcode:
LG Robin
unit Unit2;
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TForm1 = class(TForm) Button1: TButton; Button2: TButton; Button3: TButton; Button4: TButton; Button5: TButton; Button6: TButton; Button7: TButton; Button8: TButton; Button9: TButton; Timer1: TTimer; Label1: TLabel; Label2: TLabel; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure Button4Click(Sender: TObject); procedure Button5Click(Sender: TObject); procedure Button6Click(Sender: TObject); procedure Button7Click(Sender: TObject); procedure Button8Click(Sender: TObject); procedure Button9Click(Sender: TObject); procedure Timer1Timer(Sender: TObject); private { Private-Deklarationen } public { Public-Deklarationen } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin RANDOMIZE; Button1.Caption:=IntToStr(Random(9)+1); if Button1.Caption=Button2.Caption then Button2.Caption:=IntToStr(Random(9)+1); if Button1.Caption=Button3.Caption then Button3.Caption:=IntToStr(Random(9)+1); if Button1.Caption=Button4.Caption then Button4.Caption:=IntToStr(Random(9)+1); if Button1.Caption=Button5.Caption then Button5.Caption:=IntToStr(Random(9)+1); if Button1.Caption=Button6.Caption then Button6.Caption:=IntToStr(Random(9)+1); if Button1.Caption=Button7.Caption then Button7.Caption:=IntToStr(Random(9)+1); if Button1.Caption=Button8.Caption then Button8.Caption:=IntToStr(Random(9)+1); if Button1.Caption=Button9.Caption then Button9.Caption:=IntToStr(Random(9)+1); end; procedure TForm1.Button2Click(Sender: TObject); begin RANDOMIZE; Button2.Caption:=IntToStr(Random(9)+1); if Button2.Caption=Button1.Caption then Button1.Caption:=IntToStr(Random(9)+1); if Button2.Caption=Button3.Caption then Button3.Caption:=IntToStr(Random(9)+1); if Button2.Caption=Button4.Caption then Button4.Caption:=IntToStr(Random(9)+1); if Button2.Caption=Button5.Caption then Button5.Caption:=IntToStr(Random(9)+1); if Button2.Caption=Button6.Caption then Button6.Caption:=IntToStr(Random(9)+1); if Button2.Caption=Button7.Caption then Button7.Caption:=IntToStr(Random(9)+1); if Button2.Caption=Button8.Caption then Button8.Caption:=IntToStr(Random(9)+1); if Button2.Caption=Button9.Caption then Button9.Caption:=IntToStr(Random(9)+1); end; procedure TForm1.Button3Click(Sender: TObject); begin RANDOMIZE; Button3.Caption:=IntToStr(Random(9)+1); if Button3.Caption=Button1.Caption then Button1.Caption:=IntToStr(Random(9)+1); if Button3.Caption=Button2.Caption then Button2.Caption:=IntToStr(Random(9)+1); if Button3.Caption=Button4.Caption then Button4.Caption:=IntToStr(Random(9)+1); if Button3.Caption=Button5.Caption then Button5.Caption:=IntToStr(Random(9)+1); if Button3.Caption=Button6.Caption then Button6.Caption:=IntToStr(Random(9)+1); if Button3.Caption=Button7.Caption then Button7.Caption:=IntToStr(Random(9)+1); if Button3.Caption=Button8.Caption then Button8.Caption:=IntToStr(Random(9)+1); if Button3.Caption=Button9.Caption then Button9.Caption:=IntToStr(Random(9)+1); end; procedure TForm1.Button4Click(Sender: TObject); begin RANDOMIZE; Button4.Caption:=IntToStr(Random(9)+1); if Button4.Caption=Button1.Caption then Button1.Caption:=IntToStr(Random(9)+1); if Button4.Caption=Button2.Caption then Button2.Caption:=IntToStr(Random(9)+1); if Button4.Caption=Button3.Caption then Button3.Caption:=IntToStr(Random(9)+1); if Button4.Caption=Button5.Caption then Button5.Caption:=IntToStr(Random(9)+1); if Button4.Caption=Button6.Caption then Button6.Caption:=IntToStr(Random(9)+1); if Button4.Caption=Button7.Caption then Button7.Caption:=IntToStr(Random(9)+1); if Button4.Caption=Button8.Caption then Button8.Caption:=IntToStr(Random(9)+1); if Button4.Caption=Button9.Caption then Button9.Caption:=IntToStr(Random(9)+1); end; procedure TForm1.Button5Click(Sender: TObject); begin RANDOMIZE; Button5.Caption:=IntToStr(Random(9)+1); if Button5.Caption=Button1.Caption then Button1.Caption:=IntToStr(Random(9)+1); if Button5.Caption=Button2.Caption then Button2.Caption:=IntToStr(Random(9)+1); if Button5.Caption=Button3.Caption then Button3.Caption:=IntToStr(Random(9)+1); if Button5.Caption=Button4.Caption then Button4.Caption:=IntToStr(Random(9)+1); if Button5.Caption=Button6.Caption then Button6.Caption:=IntToStr(Random(9)+1); if Button5.Caption=Button7.Caption then Button7.Caption:=IntToStr(Random(9)+1); if Button5.Caption=Button8.Caption then Button8.Caption:=IntToStr(Random(9)+1); if Button5.Caption=Button9.Caption then Button9.Caption:=IntToStr(Random(9)+1); end; procedure TForm1.Button6Click(Sender: TObject); begin RANDOMIZE; Button6.Caption:=IntToStr(Random(9)+1); if Button6.Caption=Button1.Caption then Button1.Caption:=IntToStr(Random(9)+1); if Button6.Caption=Button2.Caption then Button2.Caption:=IntToStr(Random(9)+1); if Button6.Caption=Button3.Caption then Button3.Caption:=IntToStr(Random(9)+1); if Button6.Caption=Button4.Caption then Button4.Caption:=IntToStr(Random(9)+1); if Button6.Caption=Button5.Caption then Button5.Caption:=IntToStr(Random(9)+1); if Button6.Caption=Button7.Caption then Button7.Caption:=IntToStr(Random(9)+1); if Button6.Caption=Button8.Caption then Button8.Caption:=IntToStr(Random(9)+1); if Button6.Caption=Button9.Caption then Button9.Caption:=IntToStr(Random(9)+1); end; procedure TForm1.Button7Click(Sender: TObject); begin RANDOMIZE; Button7.Caption:=IntToStr(Random(9)+1); if Button7.Caption=Button1.Caption then Button1.Caption:=IntToStr(Random(9)+1); if Button7.Caption=Button2.Caption then Button2.Caption:=IntToStr(Random(9)+1); if Button7.Caption=Button3.Caption then Button3.Caption:=IntToStr(Random(9)+1); if Button7.Caption=Button4.Caption then Button4.Caption:=IntToStr(Random(9)+1); if Button7.Caption=Button5.Caption then Button5.Caption:=IntToStr(Random(9)+1); if Button7.Caption=Button6.Caption then Button6.Caption:=IntToStr(Random(9)+1); if Button7.Caption=Button8.Caption then Button8.Caption:=IntToStr(Random(9)+1); if Button7.Caption=Button9.Caption then Button9.Caption:=IntToStr(Random(9)+1); end; procedure TForm1.Button8Click(Sender: TObject); begin RANDOMIZE; Button8.Caption:=IntToStr(Random(9)+1); if Button8.Caption=Button1.Caption then Button1.Caption:=IntToStr(Random(9)+1); if Button8.Caption=Button2.Caption then Button2.Caption:=IntToStr(Random(9)+1); if Button8.Caption=Button3.Caption then Button3.Caption:=IntToStr(Random(9)+1); if Button8.Caption=Button4.Caption then Button4.Caption:=IntToStr(Random(9)+1); if Button8.Caption=Button5.Caption then Button5.Caption:=IntToStr(Random(9)+1); if Button8.Caption=Button6.Caption then Button6.Caption:=IntToStr(Random(9)+1); if Button8.Caption=Button7.Caption then Button7.Caption:=IntToStr(Random(9)+1); if Button8.Caption=Button9.Caption then Button9.Caption:=IntToStr(Random(9)+1); end; procedure TForm1.Button9Click(Sender: TObject); begin RANDOMIZE; Button9.Caption:=IntToStr(Random(9)+1); if Button9.Caption=Button1.Caption then Button1.Caption:=IntToStr(Random(9)+1); if Button9.Caption=Button2.Caption then Button2.Caption:=IntToStr(Random(9)+1); if Button9.Caption=Button3.Caption then Button3.Caption:=IntToStr(Random(9)+1); if Button9.Caption=Button4.Caption then Button4.Caption:=IntToStr(Random(9)+1); if Button9.Caption=Button5.Caption then Button5.Caption:=IntToStr(Random(9)+1); if Button9.Caption=Button6.Caption then Button6.Caption:=IntToStr(Random(9)+1); if Button9.Caption=Button7.Caption then Button7.Caption:=IntToStr(Random(9)+1); if Button9.Caption=Button8.Caption then Button8.Caption:=IntToStr(Random(9)+1); end; procedure TForm1.Timer1Timer(Sender: TObject); begin if Button1.Caption=Button2.Caption then Button2.Caption:=IntToStr(Random(9)+1); if Button1.Caption=Button3.Caption then Button3.Caption:=IntToStr(Random(9)+1); if Button1.Caption=Button4.Caption then Button4.Caption:=IntToStr(Random(9)+1); if Button1.Caption=Button5.Caption then Button5.Caption:=IntToStr(Random(9)+1); if Button1.Caption=Button6.Caption then Button6.Caption:=IntToStr(Random(9)+1); if Button1.Caption=Button7.Caption then Button7.Caption:=IntToStr(Random(9)+1); if Button1.Caption=Button8.Caption then Button8.Caption:=IntToStr(Random(9)+1); if Button1.Caption=Button9.Caption then Button9.Caption:=IntToStr(Random(9)+1); if Button2.Caption=Button1.Caption then Button1.Caption:=IntToStr(Random(9)+1); if Button2.Caption=Button3.Caption then Button3.Caption:=IntToStr(Random(9)+1); if Button2.Caption=Button4.Caption then Button4.Caption:=IntToStr(Random(9)+1); if Button2.Caption=Button5.Caption then Button5.Caption:=IntToStr(Random(9)+1); if Button2.Caption=Button6.Caption then Button6.Caption:=IntToStr(Random(9)+1); if Button2.Caption=Button7.Caption then Button7.Caption:=IntToStr(Random(9)+1); if Button2.Caption=Button8.Caption then Button8.Caption:=IntToStr(Random(9)+1); if Button2.Caption=Button9.Caption then Button9.Caption:=IntToStr(Random(9)+1); if Button3.Caption=Button1.Caption then Button1.Caption:=IntToStr(Random(9)+1); if Button3.Caption=Button2.Caption then Button2.Caption:=IntToStr(Random(9)+1); if Button3.Caption=Button4.Caption then Button4.Caption:=IntToStr(Random(9)+1); if Button3.Caption=Button5.Caption then Button5.Caption:=IntToStr(Random(9)+1); if Button3.Caption=Button6.Caption then Button6.Caption:=IntToStr(Random(9)+1); if Button3.Caption=Button7.Caption then Button7.Caption:=IntToStr(Random(9)+1); if Button3.Caption=Button8.Caption then Button8.Caption:=IntToStr(Random(9)+1); if Button3.Caption=Button9.Caption then Button9.Caption:=IntToStr(Random(9)+1); if Button4.Caption=Button1.Caption then Button1.Caption:=IntToStr(Random(9)+1); if Button4.Caption=Button2.Caption then Button2.Caption:=IntToStr(Random(9)+1); if Button4.Caption=Button3.Caption then Button3.Caption:=IntToStr(Random(9)+1); if Button4.Caption=Button5.Caption then Button5.Caption:=IntToStr(Random(9)+1); if Button4.Caption=Button6.Caption then Button6.Caption:=IntToStr(Random(9)+1); if Button4.Caption=Button7.Caption then Button7.Caption:=IntToStr(Random(9)+1); if Button4.Caption=Button8.Caption then Button8.Caption:=IntToStr(Random(9)+1); if Button4.Caption=Button9.Caption then Button9.Caption:=IntToStr(Random(9)+1); if Button5.Caption=Button1.Caption then Button1.Caption:=IntToStr(Random(9)+1); if Button5.Caption=Button2.Caption then Button2.Caption:=IntToStr(Random(9)+1); if Button5.Caption=Button3.Caption then Button3.Caption:=IntToStr(Random(9)+1); if Button5.Caption=Button4.Caption then Button4.Caption:=IntToStr(Random(9)+1); if Button5.Caption=Button6.Caption then Button6.Caption:=IntToStr(Random(9)+1); if Button5.Caption=Button7.Caption then Button7.Caption:=IntToStr(Random(9)+1); if Button5.Caption=Button8.Caption then Button8.Caption:=IntToStr(Random(9)+1); if Button5.Caption=Button9.Caption then Button9.Caption:=IntToStr(Random(9)+1); if Button6.Caption=Button1.Caption then Button1.Caption:=IntToStr(Random(9)+1); if Button6.Caption=Button2.Caption then Button2.Caption:=IntToStr(Random(9)+1); if Button6.Caption=Button3.Caption then Button3.Caption:=IntToStr(Random(9)+1); if Button6.Caption=Button4.Caption then Button4.Caption:=IntToStr(Random(9)+1); if Button6.Caption=Button5.Caption then Button5.Caption:=IntToStr(Random(9)+1); if Button6.Caption=Button7.Caption then Button7.Caption:=IntToStr(Random(9)+1); if Button6.Caption=Button8.Caption then Button8.Caption:=IntToStr(Random(9)+1); if Button6.Caption=Button9.Caption then Button9.Caption:=IntToStr(Random(9)+1); if Button7.Caption=Button1.Caption then Button1.Caption:=IntToStr(Random(9)+1); if Button7.Caption=Button2.Caption then Button2.Caption:=IntToStr(Random(9)+1); if Button7.Caption=Button3.Caption then Button3.Caption:=IntToStr(Random(9)+1); if Button7.Caption=Button4.Caption then Button4.Caption:=IntToStr(Random(9)+1); if Button7.Caption=Button5.Caption then Button5.Caption:=IntToStr(Random(9)+1); if Button7.Caption=Button6.Caption then Button6.Caption:=IntToStr(Random(9)+1); if Button7.Caption=Button8.Caption then Button8.Caption:=IntToStr(Random(9)+1); if Button7.Caption=Button9.Caption then Button9.Caption:=IntToStr(Random(9)+1); if Button8.Caption=Button1.Caption then Button1.Caption:=IntToStr(Random(9)+1); if Button8.Caption=Button2.Caption then Button2.Caption:=IntToStr(Random(9)+1); if Button8.Caption=Button3.Caption then Button3.Caption:=IntToStr(Random(9)+1); if Button8.Caption=Button4.Caption then Button4.Caption:=IntToStr(Random(9)+1); if Button8.Caption=Button5.Caption then Button5.Caption:=IntToStr(Random(9)+1); if Button8.Caption=Button6.Caption then Button6.Caption:=IntToStr(Random(9)+1); if Button8.Caption=Button7.Caption then Button7.Caption:=IntToStr(Random(9)+1); if Button8.Caption=Button9.Caption then Button9.Caption:=IntToStr(Random(9)+1); if Button9.Caption=Button1.Caption then Button1.Caption:=IntToStr(Random(9)+1); if Button9.Caption=Button2.Caption then Button2.Caption:=IntToStr(Random(9)+1); if Button9.Caption=Button3.Caption then Button3.Caption:=IntToStr(Random(9)+1); if Button9.Caption=Button4.Caption then Button4.Caption:=IntToStr(Random(9)+1); if Button9.Caption=Button5.Caption then Button5.Caption:=IntToStr(Random(9)+1); if Button9.Caption=Button6.Caption then Button6.Caption:=IntToStr(Random(9)+1); if Button9.Caption=Button7.Caption then Button7.Caption:=IntToStr(Random(9)+1); if Button9.Caption=Button8.Caption then Button8.Caption:=IntToStr(Random(9)+1); end; end. Geändert von R0bin2o11 (15. Sep 2012 um 17:54 Uhr) |
![]() |
Ansicht |
![]() |
![]() |
![]() |
ForumregelnEs 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
|
|
Nützliche Links |
Heutige Beiträge |
Sitemap |
Suchen |
Code-Library |
Wer ist online |
Alle Foren als gelesen markieren |
Gehe zu... |
LinkBack |
![]() |
![]() |