Autor Beitrag
KoPhi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: Mo 06.03.06 16:25 
Hi Leute,

habe ein Problem mit der Ausgabe von Bildern in Delphi.

IF-Funktion

ausblenden Delphi-Quelltext
1:
2:
3:
if (Haus=x1) or (Haus=x2) then fenster:='fenster.bmp';
if (Haus=x3) or (Haus=x4) then dach:='dach.bmp';
if (Haus=x5) then stein:='stein.bmp';


Ausgabe

ausblenden Delphi-Quelltext
1:
2:
3:
form2.Image1.Picture.Load FromFile(fenster);
form2.Image1.Picture.Load FromFile(dach);
form2.Image1.Picture.Load FromFile(stein);


Das heißt also...er soll eines der 3en in dem 1. Imagefenster anzeigen....

Das funktioniert aber nicht.....lasse ich nur die erste Ausgabefunktion stehen geht es...sobald aber die anderen mit dazukommen zeigt er "Fehler in ...." an...

Wo ist der Fehler?

Gruß Kophi

Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt
Sinan
Hält's aus hier
Beiträge: 4



BeitragVerfasst: Mo 06.03.06 17:06 
Hallo,

so wie ich das verstanden habe, wird es auch nicht klappen.

versuche es mal so:

ausblenden Delphi-Quelltext
1:
2:
if (Haus=x1) or (Haus=x2) then form2.Image1.Picture.Loadfromfile('fenster.bmp');
if (Haus=x3) or ... then .... form2.Image1.Picture.. ... usw..


Besser wäre es natürlich wenn Du die Bilder schon zu Begin bereitstellen würdest, denke ich.

mfg

Sinan

Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt
KoPhi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: Mo 06.03.06 17:18 
Danke...so funktioniert es!

Gruß
KoPhi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: Mo 06.03.06 20:13 
Hallo,

jetzt tritt noch ein anderes Problem auf...
ausblenden Delphi-Quelltext
1:
2:
3:
if (haus=x25) or (haus=x26) then form4.Image12.Picture.LoadFromFile('dach.bmp') 

or form4.Image12.Picture.LoadFromFile('ziegel.bmp') else form4.Image12.Picture.LoadFromFile('stein.bmp');


Er sagt Operandentyp und .... nicht vereinbar oder so...

Gruß

Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mo 06.03.06 20:24 
user profile iconKoPhi hat folgendes geschrieben:

ausblenden Delphi-Quelltext
1:
2:
if (haus=x25) or (haus=x26) then form4.Image12.Picture.LoadFromFile('dach.bmp') 
or form4.Image12.Picture.LoadFromFile('ziegel.bmp') else form4.Image12.Picture.LoadFromFile('stein.bmp');


Das or verstehe ich nicht. Du sagst ihm, er soll dach.bmp laden oder ziegel.bmp. Das ist aber Quatsch. Was soll genau passieren?

Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Mo 06.03.06 20:24 
Etwas Überlegen könnte nicht schaden !!!
Da kommst du 100 %'tig selber drauf.
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mo 06.03.06 20:26 
user profile iconBlackheart666 hat folgendes geschrieben:
Etwas Überlegen könnte nicht schaden !!!
Da kommst du 100 %'tig selber drauf.

Meinst du mich oder KoPhi? :gruebel:

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Blackheart666
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2195

XP
D3Prof, D6Pers.
BeitragVerfasst: Mo 06.03.06 20:39 
War Zeitgleich, (na sicherlich den Fragesteller) aber das mit dem or war schon gemeint.
KoPhi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: Mo 06.03.06 20:57 
Nachgedacht habe ich wohl schon...sonst hätte ich es hier nicht reingepostet und vorher schon die Lösung gehabt.

Also er soll bei

(haus=x25) das "Dach.bmp" ausgeben.

(haus=x26) das "ziegel.bmp" ausgeben

wenn nichts von beiden zutrifft soll er "stein.bmp" ausgeben.

Und es gibt eben nur ein Zielimage!

Gruß
Sinan
Hält's aus hier
Beiträge: 4



BeitragVerfasst: Mo 06.03.06 23:38 
Hallöchen..

also ich würde spontan sagen:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
if haus=x25 then 
  Image1.LoadFromFile('dach.bmp') 
else 
  Image1.loadfromfile('stein.bmp');
if haus=x26 then 
  Image1.LoadFromFile('ziegel.bmp') 
else
  Image1.loadfromfile('stein.bmp');


ansonsten kannst du auch die Case Anweisung benutzen, je nachdem wie deine Zielsetzung halt ist.

Moderiert von user profile iconGausi: Beitragsformatierung überarbeitet.
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Di 07.03.06 06:54 
Bitte benutzt die Delphi-Tags, wenn ihr Source postet:

[delphi]Source[/delphi]

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
KoPhi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: Di 07.03.06 19:10 
Danke


@ Sinan

aber so ist die IF-Funktion nicht komplett...

Er soll ausgeben:

haus = x25 dann "Dach.bmp"

haus = x26 dann "ziegel.bmp"

Trifft von beiden nichts zu soll er "stein.bmp" ausgeben

Das alles ist in EINEM Image

Gruß
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Di 07.03.06 19:49 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
if Haus = x25 then
  Image1.LoadFromFile('dach.bmp');
if Haus = x26 then
  Image1.LoadFromFile('Ziegel.bmp');
if (not (Haus = x25)) AND (not (Haus = x26)) then
  Image1.LoadFromFile('Stein.bmp');

Oder mit Suche in der Entwickler-Ecke CASE OF, je nach Variablen-Typ.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
KoPhi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: Di 07.03.06 20:54 
Ok, so sollte es eigentlich funktionieren...

Aber...er zeigt das Ziegel - und Stein Bild auch korrekt an...bloß bei dach da zeigt er auch das Steinbild an....das Problem hatte ich jetzt schon bei allen Proben, die ich gemach hatte.... :?

Aber das ist nicht mein einziges Problem was ich habe....

Ich poste das andere hier auch mal rein (sagt mir wenn es falsch ist)

Ich möchte ein Programm 2-sprachig laufen lassen....dafür muss ich ja einfach die "jetzige" Version kopieren und nur den Text ändern....aber wie bekomme ich das am Besten hin mit den ganzen Editfelder usw...

PS: Noch ein anderes Problem ... Operator ist nicht auf Operandentyp andwendbar! (was heißt das)

Vielen Dank

Gruß
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Di 07.03.06 21:00 
Pro Frage einen Thread. Sonst kommt es hier zu einem durcheinander. Danke.

Sicher, dass dach.bmp auch richtig ist? Vielleicht haste beim Speichern der Bilder einen Fehler gemacht.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)