![]() |
Order and save right now!
20% off with the 729824315 dicscount code for Ultimate Pack and any another product for Delphi from Greatis Programming! |
⤷ Include jpeg as a resource in *.exe
For including jpeg as a resource in *.¥å¥ the construction {$R MyRes.RES} is necessary.For causing from a resource jpeg is necessary to create an object of TResorceStream type and to load jpeg with LoadFromStream procedure.
There is a 'HELP' section which contents a jpeg file in the resource file.
{$R MyRes.RES}
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
MyRS: TResourceStream;
begin
try
MyRS:=TResourceStream.Create(HInstance, 'HELP', RT_RCDATA);
Image1.Picture.LoadFromFile('example.jpg');
if Image1.Picture.Graphic is TJPEGImage then
TJPEGImage(Image1.Picture.Graphic).LoadFromStream(MyRS);
finally
MyRS.Free;
end;
end;
-
More for developers