Delphi-PRAXiS
Seite 4 von 5   « Erste     234 5      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Multimedia (https://www.delphipraxis.net/16-multimedia/)
-   -   Delphi Galgenmännchen (https://www.delphipraxis.net/58111-galgenmaennchen.html)

gordon freeman 2. Dez 2005 13:11

Re: Galgenmännchen
 
Du solltest dich mal mit PaintBox.OnrePaint oder so befassen. Die PaintBox zeichnet bei dir das ganze wahrscheinlich nur 1 Mal. Es muss ja ber immer gezeichnet werden, wenn das Fenster verdeckt ist. Also hau den ganzen Code zum zeichnen in die OnPaint deiner Paintbox rein.

P.S. Häng doch das nächste mal den Code bitte als Anhang dran, da scrollt man sich ja die Finger wund :wink:

tigerman33 2. Dez 2005 13:26

Re: Galgenmännchen
 
Ich zitiere mich mal selbst: :mrgreen:
Zitat:

Zitat von tigerman33
Zeichnen tut ers vermute ich mal schon. Aber beim nächsten Neuzeichnen der Paintbox wird alles wieder übergepinselt, deswegen ist nichts zu sehen. Sieh dir dazu mal das Delphi-Referenz durchsuchenOnPaint-Ereignis an.

Wenn du selbst auf dem Canvas rumzeichnest, bist du auch selbst dafür verantwortlich, dass bei jedem Neuzeichnen der Paintbox bzw des Controls auf dessen Canvas du malst auch deine eigene Grafik wieder ausgegeben wird.


Tomislav 2. Dez 2005 14:46

Re: Galgenmännchen
 
mit on paint geht es auch nicht richtig
da macht er zeichenfehler

Tomislav 2. Dez 2005 15:08

Re: Galgenmännchen
 
Delphi-Quellcode:
procedure TForm1.PBP1OnPaint(Sender: TObject);
begin
  if
 (lblFehler1.Caption = '0')
 then
  begin
   with PBP1.canvas do
    begin
    x.x := 5;
    x.y := 65;
    y.x := 65;
    y.y := x.y;
    moveto(x.x, x.y);
    lineto(y.x, y.y);
    end;
  end;

 if
 (lblFehler1.Caption = '1')
 then
 begin
   with PBP1.canvas do
    begin
    x.x := 5;
    x.y := 65;
    y.x := 65;
    y.y := x.y;
    xx1.x := 20;
    xx1.y := x.y;
    xx2.x := 20;
    xx2.y := 10;
    moveto(x.x, x.y);
    lineto(y.x, y.y);
    moveto(xx1.x, xx1.y);
    lineto(xx2.x, xx2.y);
    end;
 end;
end;
was muss ich machen?

tigerman33 2. Dez 2005 15:13

Re: Galgenmännchen
 
Also zumindest in deinem letzten Code tauchte lblFehler nicht auf. Generell solltest du solche Abfragen über die Caption vermeiden, das ist nicht besonders elegant. Mach lieber eine Boolean-Variable für deine Abfrage.

Zu deinem konkreten Problem würde ich mal vermuten, dass entweder lblFehler.Caption weder '1' noch '0' ist, oder du deine Paintbox wieder auf invisible gestellt hast.

Tomislav 2. Dez 2005 23:43

Re: Galgenmännchen
 
es ist nicht invisible
guckt es euch an
www.spvgg-hadamar-tt.de/Spiel.zip

tigerman33 3. Dez 2005 00:04

Re: Galgenmännchen
 
Da gibt's nicht viel zum angucken, es fehlt nämlich der Sourcecode... :roll:

//edit:
von dem ich vorschlagen würde, dass du ihn einfach mal anhängst.

Tomislav 3. Dez 2005 08:05

Re: Galgenmännchen
 
????

tigerman33 3. Dez 2005 10:30

Re: Galgenmännchen
 
In dem zipfile ist nur die exe und die txt. Wie sollen wir denn den Fehler in deinem Code finden, wenn du den Code nicht da mit reinpackst?
Wenn du den nicht auf dieser Webseite zur Verfügung stellen willst, kannst du ihn ja einfach als Anhang (!) hier im Forum posten.(Ganz unten über dem Button "Vorschau").

Tomislav 3. Dez 2005 10:33

Re: Galgenmännchen
 
Delphi-Quellcode:
procedure TForm1.Spieler1(Sender: TObject);
begin
 if
 (RBP1.Checked = true) and (lblString1.Caption = A) and (lblString2.Caption = B) and (lblString3.Caption = C) and (lblString4.Caption = D) and (lblString5.Caption = E) and (lblString6.Caption = F) and (lblString7.Caption = G) and (lblString8.Caption = H) and (lblString9.Caption = I) and (lblString10.Caption = J) and (lblString11.Caption = K) and (lblString12.Caption = L)
 then
 begin
 Application.MessageBox('Spieler 1 hat gewonnen!','Gewinner');
 btnWortwahlClick(Sender);
 end;

 if
 (Antwort = A) or (Antwort = B) or (Antwort = C) or (Antwort = D) or (Antwort = E) or (Antwort = F) or (Antwort = G) or (Antwort = H) or (Antwort = I) or (Antwort = J) or (Antwort = K) or (Antwort = L)
 then
 begin
 end
 else
 begin
 RBP1.Checked := false;
 RBP2.Checked := true;
 Application.MessageBox('Leider ist dieser Buchstabe nicht dabei! Spieler 2 ist an der Reihe!','!!!');
 aa := StrToInt(lblFehler1.Caption);
 aa := aa+1;
 lblFehler1.Caption := IntToStr(aa);
 end;
end;

procedure TForm1.Spieler2(Sender: TObject);
begin
 if
 (RBP2.Checked = true) and (lblString1.Caption = A) and (lblString2.Caption = B) and (lblString3.Caption = C) and (lblString4.Caption = D) and (lblString5.Caption = E) and (lblString6.Caption = F) and (lblString7.Caption = G) and (lblString8.Caption = H) and (lblString9.Caption = I) and (lblString10.Caption = J) and (lblString11.Caption = K) and (lblString12.Caption = L)
 then
 begin
 Application.MessageBox('Spieler 2 hat gewonnen!','Gewinner');
 btnWortwahlClick(Sender);
 end;

 if
 (Antwort = A) or (Antwort = B) or (Antwort = C) or (Antwort = D) or (Antwort = E) or (Antwort = F) or (Antwort = G) or (Antwort = H) or (Antwort = I) or (Antwort = J) or (Antwort = K) or (Antwort = L)
 then
 begin
 end
 else
 begin
 RBP2.Checked := false;
 RBP1.Checked := true;
 Application.MessageBox('Leider ist dieser Buchstabe nicht dabei! Spieler 1 ist an der Reihe!','!!!');
 bb := StrToInt(lblFehler2.Caption);
 bb := bb+1;
 lblFehler2.Caption := IntToStr(bb);
 end;

end;

procedure TForm1.PBP2OnPaint(Sender: TObject);
begin

 if
 (lblFehler2.Caption = '0')
 then
  begin
   with PBP2.canvas do
    begin
    x.x := 5;
    x.y := 65;
    y.x := 65;
    y.y := x.y;
    moveto(x.x, x.y);
    lineto(y.x, y.y);
    end;
  end;


 if
 (lblFehler2.Caption = '1')
 then
  begin
   with PBP2.canvas do
    begin
    x.x := 5;
    x.y := 65;
    y.x := 65;
    y.y := x.y;
    xx1.x := 20;
    xx1.y := x.y;
    xx2.x := 20;
    xx2.y := 10;
    moveto(x.x, x.y);
    lineto(y.x, y.y);
    moveto(xx1.x, xx1.y);
    lineto(xx2.x, xx2.y);
    end;
  end;
end;

procedure TForm1.PBP1OnPaint(Sender: TObject);
begin
  if
 (lblFehler1.Caption = '0')
 then
  begin
   with PBP1.canvas do
    begin
    x.x := 5;
    x.y := 65;
    y.x := 65;
    y.y := x.y;
    moveto(x.x, x.y);
    lineto(y.x, y.y);
    end;
  end;

 if
 (lblFehler1.Caption = '1')
 then
 begin
   with PBP1.canvas do
    begin
    x.x := 5;
    x.y := 65;
    y.x := 65;
    y.y := x.y;
    xx1.x := 20;
    xx1.y := x.y;
    xx2.x := 20;
    xx2.y := 10;
    moveto(x.x, x.y);
    lineto(y.x, y.y);
    moveto(xx1.x, xx1.y);
    lineto(xx2.x, xx2.y);
    end;
 end;
end;

end.


Alle Zeitangaben in WEZ +1. Es ist jetzt 11:19 Uhr.
Seite 4 von 5   « Erste     234 5      

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz