I have a procedure to fill the initial bitmap's canvas of TImage (ItemImage):
procedure TfrmMain.ClearImage();
begin
with ItemBmp.Canvas do
begin
// form's background color
Brush.Color := GetColorResolvingParent;
Brush.Style := bsSolid;
FillRect(Rect(0, 0, Width, Height));
end;
// update image
ItemImage.Picture.Bitmap.Canvas.Draw(0, 0, ItemBmp);
end;
First of all: if I call this procedure in FormShow, then ItemImage remains black. When I call it two times in FormShow, then I get the desired result.
Also, it appears that I need a second bitmap (ItemBmp) to clear the image; if I try to do the fillrect directly on ItemImage, it remains black.
Before calling this procedure, Width and Height are properly set in FormShow:
procedure TfrmMain.FormShow(Sender: TObject);
begin
// setup bitmaps
ItemBmp := TBitMap.Create;
with ItemImage.Picture.Bitmap do
begin
// fixed size
SetSize(610, 546);
ItemBmp.SetSize(Width, Height);
end;
ClearImage;
ClearImage;
end;
This is on Debian Linux 7.8. I am probably doing something wrong, but I cannot figure out what it is.