Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
Delphi 10.2 Tokyo Professional
|
AW: Jpeg als TGPBitmap aus Resource laden
17. Feb 2016, 09:36
Hallo,
Probiers mal so:
Delphi-Quellcode:
procedure TMain.LoadFromResource(const S:String; var Bmp:TGPBitmap);
var Stream:TResourceStream;
adapter: TStreamAdapter;
begin
Stream:=TResourceStream.Create(HInstance,S, RT_RCDATA);
adapter := TStreamAdapter.Create(Stream);
Bmp:=TGPBitmap.Create(adapter, False);
adapter.Free;
Stream.Free;
end;
(PS: Ein try-finally ist beim Erzeugen/Zerstören von Objekten sehr sinnvoll)
Michael "Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."
|