Re: Drawing on Delphi TImage

Posted by DelphiLand Team

In Reply to: Drawing on Delphi TImage Stanley

: procedure TForm1.Button1Click(Sender: TObject);
: begin
: with Image1.Canvas do begin
: Brush.Style := bsSolid;
: Brush.Color := clBlue;
: Rectangle(0, 0, Image1.Width, Image1.Height);
: end;
: end;
: This does not work if there is a JPG picture in Image1. Is it a bug in Delphi?
----------------------

It's not a bug. Canvas is only available if the Picture property of the TImage represents a TBitmap. When Picture represents another type of graphic image, this gives an error.