Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2018-07

Brush Bitmap anomaly

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Van Canneyt

Hello,

When I draw a rectangle with a brush that contains a bitmap, it's impossible to assign the bitmap directly from a glyph.

The following works: (BImage is a TBitBtn), the form is painted with the image on the bitbutton.

procedure TMainForm.PaintBitmapBrush;
begin
   FreeAndNil(FBrushBitmap);
   FBrushBitmap:=TBitmap.Create;
   FBrushBitmap.Width:=BImage.Glyph.Width;
   FBrushBitmap.Height:=BImage.Glyph.Height;
   FBrushBitmap.Canvas.Draw(0,0,BImage.Glyph);
   Canvas.Brush.Bitmap:=FBrushBitmap;
   Canvas.Rectangle(0,0,Width-1,Height-1);
end;

This does not work:

procedure TMainForm.PaintBitmapBrush;
begin
   Canvas.Brush.Bitmap:=BImage.Glyph;
   Canvas.Rectangle(0,0,Width-1,Height-1);
end;

Is this a bug or is this intentional ?

BImage.Glyph is of type TBitmap, so I would expect this to work as well...

Michael.

Reply by email