[Lazarus] Brush Bitmap anomaly

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] Brush Bitmap anomaly

Free Pascal - Lazarus mailing list

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.
--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus