Autor Beitrag
Dia
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 26



BeitragVerfasst: Mo 26.11.07 09:01 
Hi,

ich lade mit folgenden Code Bilder in ein Image

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure PPict(I1: TImage; Pict:TPicture; filename:string; GBcal: TGroupBox; Lsol: TLabel);
begin
Pict:=TPicture.Create;
Pict.LoadFromFile('Bilder'+filename);
I1.Visible:=true;
I1.Picture:=Pict;
GBcal.Visible:=False;
Lsol.Visible:=true;
end;


Aufrufen tu ich die Procedure wiefolgt:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
procedure TFcalender.L8Click(Sender: TObject);
begin
today:=strtoint(l8.caption);
Pdatum(present,year,today,day,month);
if valuable = true then
   begin
   filename:='musik.jpg';
   PPict(I1, Pict, filename,GBcal,Lsol);
   end;
Lzoom.Visible:=true;
end;


Das hat auch immer alles funkioniert, bis ich ein neues Formular eingebunden habe. Selbst wenn ich nicht auf dieses Formular zugreife, läd er mir die Bilder nicht in das Image, sondern bringt eine Fehlermeldung EFOpenError.

Weiß jemand woran das liegen könnte. Wenn ich das Foruular rausnehme (das uses lösche) läufts übrigens immer noch nicht. Erst wenn ich Delphi komplett neu gestartet habe funktionierts wieder.

Danke

EDIT:
das muss natürlich
Pict.LoadFromFile('Bilder/'+filename);
mach's aber auch nicht besser.

Moderiert von user profile iconjasocul: Beiträge zusammengefasst
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 26.11.07 09:28 
Du musst ein absolutes Verzeichnis verwenden, sonst ist es Glückssache (ok, man kann das auch steuern) ob das funktioniert:
ausblenden Delphi-Quelltext
1:
Pict.LoadFromFile(ExtractFilePath(ParamStr(0)) + '\Bilder\' + filename);