Autor Beitrag
TomZ
Hält's aus hier
Beiträge: 13


D8 Pers, FreePascal
BeitragVerfasst: Di 23.08.05 23:53 
Hallo,

ich hab auf einer Form ein TImage liegen. Nun möchte ich gerne während der Laufzeit das enthaltene Bild ändern.

image1.Picture.Loadfromfile erzeugt keinen Fehler, allerdings wird das Bild auch nicht aktualisiert ...
jjturbo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 516

Win2000 prof., WinXP prof.
D4 Stand., D5 Prof, D7 Prof, D2007 Prof.
BeitragVerfasst: Mi 24.08.05 11:35 
Eigentlich sollte LoadFromFile ausreichen, um das Bild neu zu zeichnen. Poste doch mal etwas von dem Code.

Gruß, jjturbo

_________________
Windows XP: Für die einen nur ein Betriebssystem - für die anderen der längste Virus der Welt...
Amateur
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 777

(Win98, WinMe) WinXP Prof
D3 Prof, D6 Pers, D2k5 Pers., Turbo C++ Explorer
BeitragVerfasst: Mi 24.08.05 12:01 
ansonsten viell noch nen refresh oder so dazu aber loadfromfile sollte wirklich ausreichen... probier ma image1.refresh oder image1.repaint...
TomZ Threadstarter
Hält's aus hier
Beiträge: 13


D8 Pers, FreePascal
BeitragVerfasst: Mi 24.08.05 12:30 
Hhhmmm, das ganze wird immer seltsamer ... ich hab einfach sowas hier:

ausblenden Delphi-Quelltext
1:
image1.Picture.LoadFromFile('d:\dvd\bands\2\bild.bmp');					


Das Bild wird definitiv nicht angezeigt, weder Refresh noch Repaint bringen da was. Wenn ich dagegen einen OpenPictureDialog benutze dann gehts manchmal:

ausblenden Delphi-Quelltext
1:
2:
if openpicturedialog1.Execute then
image1.Picture.LoadFromFile(openpicturedialog1.FileName);


Und manchmal gehts auch nicht ... sehr seltsam das Ganze, ich werds mal auf einem anderen PC testen ... (Ist Delphi 2005 Personal).
Amateur
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 777

(Win98, WinMe) WinXP Prof
D3 Prof, D6 Pers, D2k5 Pers., Turbo C++ Explorer
BeitragVerfasst: Mi 24.08.05 12:50 
also irgendwas haste falsch gecodet oder dein pc bzw. delphi spinnt denn bei mir geht es einwandfrei:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
procedure TForm1.Button1Click(Sender: TObject);
const pfad:string = 'Dein pfad';
begin
image1.picture.loadfromfile(pfad+'euro.bmp');
end;
Danniolo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 693



BeitragVerfasst: Mi 24.08.05 13:30 
Kann's vielleicht sein, dass das gar kein Bitmap sondern eine JPG-Datei ist,
dann musst du noch jpeg ins uses - Klausel aufnehmen...
:?:
Fabian W.
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1766

Win 7
D7 PE
BeitragVerfasst: Mi 24.08.05 13:49 
Wenn kein BMp is wird auch keine Datei geöffnet, weil die sonst 'Bild.jpg' oder sonst wie heißen würde.
Danniolo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 693



BeitragVerfasst: Mi 24.08.05 13:53 
Zitat:
'Bild.jpg' oder sonst wie heißen würde
:arrow:

Muss nicht sein, kommt auch mal vor, dass eine JPEG - Datei aus Versehen als BMP umbenannt wurde... War ja nur sone Idee, dass ja auch da der Fehler liegen könnte,
denn sowas is mir ehrlich gesagt noch nie passiert :roll:
Fabian W.
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1766

Win 7
D7 PE
BeitragVerfasst: Mi 24.08.05 13:57 
Wie willst du bitte aus versehen die Endung einer Datei ändern?
Im Editor - aus versehen?

Kann es sein, dass der Pfad Leerzeichen enthält?
TomZ Threadstarter
Hält's aus hier
Beiträge: 13


D8 Pers, FreePascal
BeitragVerfasst: Mi 24.08.05 14:32 
OK, ich glaube ich komme der Sache etwas näher ... ich hatte die Hintergrundfarbe der zugrundeliegenden Form auf Schwarz gesetzt ... da scheints Probleme mit zu geben. Wenn ich die Farbe wieder auf das Standard-Windows-Hintergrund-Grau ändere dann klappts wieder einwandfrei ...

(Nein, das Bild ist *nicht* einfach nur schwarz ...)
Fabian W.
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1766

Win 7
D7 PE
BeitragVerfasst: Mi 24.08.05 15:15 
Guck acu mal ob die Eigenschaft Transparent des Images auf true oder false steht.
TomZ Threadstarter
Hält's aus hier
Beiträge: 13


D8 Pers, FreePascal
BeitragVerfasst: Mi 24.08.05 17:41 
Hhm, ich hab einfach ein neues Projekt angelegt, jetzt klappts ... :roll:
Danniolo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 693



BeitragVerfasst: Mi 24.08.05 18:55 
Recht eigenartig alles... :?:
TomZ Threadstarter
Hält's aus hier
Beiträge: 13


D8 Pers, FreePascal
BeitragVerfasst: Mi 24.08.05 19:21 
user profile iconDanniolo hat folgendes geschrieben:
Recht eigenartig alles... :?:


Ja, aber bei mir nachvollziehbar ... habs gerade nochmal durchgecheckt, in dem alten Projekt klappt es definitiv *nicht*.

Na ja, was solls.