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: |
Re: Galgenmännchen
Ich zitiere mich mal selbst: :mrgreen:
Zitat:
|
Re: Galgenmännchen
mit on paint geht es auch nicht richtig
da macht er zeichenfehler |
Re: Galgenmännchen
Delphi-Quellcode:
was muss ich machen?
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; |
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. |
Re: Galgenmännchen
|
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. |
Re: Galgenmännchen
????
|
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"). |
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. |
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