Autor Beitrag
Johbor
Hält's aus hier
Beiträge: 3



BeitragVerfasst: Mi 28.03.07 11:56 
Moin moin!

Also ich versuche zur zeit Hangman zu programieren, allerdings verstehe ich nicht, wie ich Bilder aus dem Teil "ImageList1" in mein Imagefeld reinbekomme. Ich habe für meine verschiedenen Hangmanabschnitte, jeweils ein neues Bild gemacht und will nun erreichen, dass das Programm immer ein Bild weiter schalten soll, wenn man einen falschen Buchstaben schreibt.

ausblenden Delphi-Quelltext
1:
2:
  if Panel41.Caption='B'then if Panel40.Caption='B' then if Panel39.Caption='B' then if Panel38.Caption='B' then if Panel37.Caption='B' then if Panel36.Caption='B' then if Panel35.Caption='B' then if Panel34.Caption='B' then if Panel33.Caption='B' then if Panel32.Caption='B' then if Panel31.Caption='B' then if Panel30.Caption='B' then if Panel29.Caption='B' then if Panel28.Caption='B' then if Panel27.Caption='B' then Label1.Caption:='';
  if Panel41.Caption<>'B'then if Panel40.Caption<>'B' then if Panel39.Caption<>'B' then if Panel38.Caption<>'B' then if Panel37.Caption<>'B' then if Panel36.Caption<>'B' then if Panel35.Caption<>'B' then if Panel34.Caption<>'B' then if Panel33.Caption<>'B' then if Panel32.Caption<>'B' then if Panel31.Caption<>'B' then if Panel30.Caption<>'B' then if Panel29.Caption<>'B' then if Panel28.Caption<>'B' then if Panel27.Caption<>'B' then Image1.Picture.LoadFromFile ('hot_mops.jpg');



Ein weiteres Problem erscheint bei folgendem Quellcodeabschnitt:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
procedure TForm1.FormCreate(Sender: TObject);
begin
  if Panel27.Visible=True
  then if Panel28.Visible=True
  then if Panel29.Visible=True
  then if Panel30.Visible=True
  then if Panel31.Visible=True
  then if Panel32.Visible=True
  then if Panel33.Visible=True
  then if Panel34.Visible=True
  then if Panel35.Visible=True
  then if Panel36.Visible=True
  then if Panel37.Visible=True
  then if Panel38.Visible=True
  then if Panel39.Visible=True
  then if Panel40.Visible=True
  then if Panel41.Visible=True
  then Image2.Picture.Loadfromfile ('Dragon DBGT SERIE 1.jpg')   and Panel1.Visible:=False
                                                                 and Panel2.Visible:=False
                                                                 and Panel3.Visible:=False
                                                                 and Panel4.Visible:=False
                                                                 and Panel5.Visible:=False
                                                                 and Panel6.Visible:=False
                                                                 and Panel7.Visible:=False
                                                                 and Panel8.Visible:=False
                                                                 and Panel9.Visible:=False
                                                                 and Panel10.Visible:=False
                                                                 and Panel11.Visible:=False
                                                                 and Panel12.Visible:=False
                                                                 and Panel13.Visible:=False
                                                                 and Panel14.Visible:=False
                                                                 and Panel15.Visible:=False
                                                                 and Panel16.Visible:=False
                                                                 and Panel17.Visible:=False
                                                                 and Panel18.Visible:=False
                                                                 and Panel19.Visible:=False
                                                                 and Panel20.Visible:=False
                                                                 and Panel21.Visible:=False
                                                                 and Panel22.Visible:=False
                                                                 and Panel23.Visible:=False
                                                                 and Panel24.Visible:=False
                                                                 and Panel25.Visible:=False
                                                                 and Panel26.Visible:=False ;
end;

Hier zeigt er mir das an: [Fehler] Unit1.pas(649): Operator ist auf diesen Operandentyp nicht anwendbar

Wie kann ich das beheben, weil auch mein Lehrer da nicht weiter weiss.

Moderiert von user profile iconraziel: Delphi-Tags hinzugefügt
Robinator
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 275

WinXP
BDS 2006
BeitragVerfasst: Mi 28.03.07 12:20 
Erstmal Hi! ;)

1. Du solltest Delphi tags nutzen, dann kann man deinen code besser lesen
2. Du solltest dir vielleicht mal die Grundlagen aneignen
3. Dein Code ist Syntaktisch fehlerhaft
Wenn du mehrere Wahrheitswerte kombinieren willst, musst du die einzelnen Aussagen einklammern
ausblenden Delphi-Quelltext
1:
if (bedingung1 = True) and (Bedingung2 = false) then foo;					


noch ein Fehler:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
then if Panel41.Visible=True then
begin
  Image2.Picture.Loadfromfile ('Dragon DBGT SERIE 1.jpg');
  Panel1.Visible:=False;
  Panel2.Visible:=False;
  Panel3.Visible:=False;
  Panel4.Visible:=False;
  Panel5.Visible:=False;
  Panel6.Visible:=False;
  Panel7.Visible:=False;
  Panel8.Visible:=False;
  Panel9.Visible:=False;
  Panel10.Visible:=False;
  Panel11.Visible:=False;
  Panel12.Visible:=False;
  {...}
end;


gruss, Rob

_________________
erare humanum est
Johbor Threadstarter
Hält's aus hier
Beiträge: 3



BeitragVerfasst: Fr 30.03.07 08:33 
Danke für deine Hilfe, aber was meinst du mit Grundlagen? selbst unser Lehrer konnte mir nicht weiterhelfen :(
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Fr 30.03.07 10:18 
Schau Dir mal FindComponent an, damit sparst Du Dir etliches.
ausblenden Delphi-Quelltext
1:
2:
3:
for i:= 1 to 500 do
    if  TPanel(FindComponent('Panel'+IntToStr(i))).Visible = True
    then ImageList1.GetBitmap(0, Image.Picture.Bitmap);

_________________
Blackheart666
Der Irrsinn ist bei Einzelnen etwas Seltenes, - aber bei Gruppen, Parteien, Völkern, Zeiten die Regel. (Friedrich Nietzsche)
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Fr 30.03.07 11:15 
user profile iconJohbor hat folgendes geschrieben:
Danke für deine Hilfe, aber was meinst du mit Grundlagen?
Ein Lehrer, der nicht mal die simpelsten Grundlagen der Programmierung vermitteln kann. Typisches Beispiel, kenn ich aus eigener Erfahrung. Hier dein höchst persönlicher Lehrer: Crashkurs Delphi von Christian S.

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
Johbor Threadstarter
Hält's aus hier
Beiträge: 3



BeitragVerfasst: Di 10.04.07 00:04 
Danke für den Link mit dem Crashkurs! Hat mir etliches neues gezeigt, wovon der Lehrer keine Ahnung hat (haben wird) hehe!

Ganz großes Danke an alle, die geantwortet haben

MfG Johannes
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Di 10.04.07 03:04 
Markiere doch bitte dieses Thema als erledigt. Das geht ganz einfach, in dem du auf das HIER unter dem letzten Beitrag klickst.

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.