Providing the entire (unfinished code) can be provided, but maybe this is enough to get started;
Procedure xyz;
var icnInactive : TPicture;
begin
...
{$I pngicons.lrs} // resources hold transparant PNG, icn_inactive
...
icnInactive := TPicture.Create;
icnInactive.LoadFromLazarusResource('icn_inactive');
...
APanel.Canvas.CopyRect(Rect(0,0,16,16),icnInactive.Bitmap.Canvas,Rect(0,0,16,16));
...
end;
APanel is an existing TPanel on Form1.
I'm loading the picture in a TImage because multiple images are copied on the TPanel depending on states.
Setting Pixelformat didn't make a difference either ...
icnInactive.Bitmap.PixelFormat:=pf32Bit;
Using Draw instead of CopyRect (with and without PixelFormat set to 32 bit) didn't work either;
APanel.Canvas.Draw(0,0,icnInactive.Graphic);