Autor Beitrag
Xabitire
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 114

Win Xp, Win Vista
D6 PE, D7 PE
BeitragVerfasst: Di 23.01.07 17:49 
Hi Leute,

Also ich hab ein Programm, dass beim Starten per Zufall ein Bild von mehreren auf eine bestimmet Fläche des Forms laden soll. Nach Forensuche bin ich auf diesen Befehl gestoßen:

Image1.picture.loadfromfile('pfad');

Das hab ich natürlich sofort ausprobiert kam aber ne Fehlermeldung, dass im Projekt eine Exception der Klasse EInvalidGraphic aufgetreten sei. Hab schon so nach na Lösung gesucht, aber keine gefunden! Kann mir vielleicht einer sagen, was ich da machen kann?
Robinator
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 275

WinXP
BDS 2006
BeitragVerfasst: Di 23.01.07 18:00 
Welches format haben die Bilder denn?
Jann1k
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 866
Erhaltene Danke: 43

Win 7
TurboDelphi, Visual Studio 2010
BeitragVerfasst: Di 23.01.07 18:00 
poste mal ein den relevanten teil deines codes, mir fällt nur spontan ein, dass das Format des Bildes von deiner Anwendung nicht unterstützt wird.
_Blackhawk_
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 18

WinXP Prof, Linux 9.3
Delphi 7, C++, Turbo Pascal 7
BeitragVerfasst: Di 23.01.07 18:05 
also ich schätze mal du versuchst hier JPEGs zu laden, die werden aber nur unterstützt wenn du die jpeg-Komponente mit einbindest:

ausblenden Delphi-Quelltext
1:
uses ..., JPEG;					
Xabitire Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 114

Win Xp, Win Vista
D6 PE, D7 PE
BeitragVerfasst: Di 23.01.07 18:15 
Die Jpeg-Komponente ist eingetragen! Und außerdem hab ichs auch schon mit .bmp versucht.

Hier ist der Zugehörige Quelltext

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm3.FormCreate(Sender: TObject);
begin

  codepicture.picture.LoadFromFile('C:/Bild.bmp');

end;


Moderiert von user profile iconraziel: Quote- durch Delphi-Tags ersetzt
Xabitire Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 114

Win Xp, Win Vista
D6 PE, D7 PE
BeitragVerfasst: Di 23.01.07 18:16 
Ach, und codepicture is der Name meines Bildes!
_Blackhawk_
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 18

WinXP Prof, Linux 9.3
Delphi 7, C++, Turbo Pascal 7
BeitragVerfasst: Di 23.01.07 18:30 
du musst wahrscheinlich codepicture erst noch initialisieren:

ausblenden Delphi-Quelltext
1:
2:
3:
codepicture:=TImage.Create(self);
bzw
codepicture:=TPicture.Create(self);

(das self nur einbinden falls benötigt)
Xabitire Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 114

Win Xp, Win Vista
D6 PE, D7 PE
BeitragVerfasst: Di 23.01.07 18:38 
Nee, immer noch das selbe :( :( :(

PS: Ich habs schon mit dem Format .jpg, .jpeg, .bmp versucht! Immer das selbe!
_Blackhawk_
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 18

WinXP Prof, Linux 9.3
Delphi 7, C++, Turbo Pascal 7
BeitragVerfasst: Di 23.01.07 18:42 
hmm kannst du die BMP-Datei auf die Bitmap-Komponente laden ?

ausblenden Delphi-Quelltext
1:
codepicture.bitmap.loadfromfile(...);					
OldGrumpy
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 82



BeitragVerfasst: Di 23.01.07 18:43 
user profile iconblackbird8690 hat folgendes geschrieben:
Die Jpeg-Komponente ist eingetragen! Und außerdem hab ichs auch schon mit .bmp versucht.

Hier ist der Zugehörige Quelltext

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
procedure TForm3.FormCreate(Sender: TObject);
begin

  codepicture.picture.LoadFromFile('C:/Bild.bmp');

end;


Vielleicht solltest Du es mal mit 'C:\Bild.bmp' probieren? :)
Xabitire Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 114

Win Xp, Win Vista
D6 PE, D7 PE
BeitragVerfasst: Di 23.01.07 18:46 
Es ist eigentlich prinzipiell egal, ob man \ oder / verwendet!
Xabitire Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 114

Win Xp, Win Vista
D6 PE, D7 PE
BeitragVerfasst: Do 25.01.07 17:09 
Ich hab die Ursache für das Problem gefunden!

Ich hatte die Bilder am anfang unter .png abgespeichert un hab dann einfach die endung umbenannt! Nachdem ich dann mal ein anderes Bild ausprobiert hatte, hatte ich es dann bemerkt!

sry, war mein Fehler! (war ja mal wieder klar :roll: )

thx noch!