[Lazarus] Resources

Sven Barth pascaldragon at googlemail.com
Sun Nov 24 14:32:50 CET 2013


On 24.11.2013 03:26, Donald Ziesig wrote:
>    Image1.Picture.LoadFromLazarusResource('PIX2');  // Tried 'pix2' as well

Lazarus Resources <> FPC Resources

Lazarus Resources where the resources that were used before FPC 
supported resources itself. So kick out the LResources unit and change 
the call to:

=== code begin ===

res := TResourceStream.Create(HInstance, 'PIX2', 'BITMAP');
try
   Image1.Picture.LoadFromStream(res);
finally
   res.Free;
end;

=== code end ===

If you know the file extension (e.g. you don't allow the users to put in 
a PNG resource while your default one is a BMP resource) you could also 
use LoadFromStreamWithFileExt instead.

Regards,
Sven




More information about the Lazarus mailing list