[lazarus] PNG and resource
Tony Maro
tony at maro.net
Sun Nov 9 19:01:14 EST 2003
Darek Mazur wrote:
>Hi
>
>I've try use resources like in delphi
>I've notice that no function to load bitmap from resource (only truecolor)
>Than try PNG to store button image but in graphics.pp is bug or I can't
>understand it.
>
Try something like this:
Create your graphic, for instance "mypicture.xpm". (Pixmap's work great)
Then convert it to a resource at the command line:
> lazres mygraphicresource.lrs mypicture.xpm
In your code use:
MyGraphic := TPixmap.Create;
MyGraphic.LoadFromLazarusResource('mypicture');
in the Initialization section at the end of the unit be sure to add:
{$I mygraphicresource.lrs} // inserts the resource into the unit
-Tony
More information about the Lazarus
mailing list