When I try something like this I get a runtime error:
procedure TListForm.PaintBox1MouseDown(Sender: PControl;
var Mouse: TMouseEventData);
var bitmap:PBitmap;
MyRect:TRect;
begin
bitmap:=NewBitmap(77,77);
bitmap.LoadFromResourceName(0,'mybitmap');
MyRect:=bitmap.BoundsRect;
PaintBox1.Canvas.CopyRect(MyRect,bitmap.canvas,MyRect);
bitmap.Destroy;
end;
The error is not there when I remove the CopyRect line, but of course then my Paintbox stays empty.