[Lazarus] TImage Canvas not growing with Image? GTK2
Mattias Gaertner
nc-gaertnma at netcologne.de
Wed May 19 11:30:03 CEST 2010
On Wed, 19 May 2010 10:35:40 +0200
theo <xpde at theo.ch> wrote:
> Hello
>
> Is it correct, that the paintable area of an Image.Canvas is not growing
> with the Image?
>
> Example:
> Put a TImage on an empty Form. Set Align to alClient.
>
> Then put for ex. this code in Form.OnChangeBounds
>
> procedure TForm1.FormChangeBounds(Sender:TObject);
> begin
> With Image1 do
> begin
> Canvas.Brush.Color:=clWhite;
> Canvas.FillRect(0,0,Width,Height);
> Canvas.MoveTo(0,0);
> Canvas.LineTo(Width,Height);
> Canvas.MoveTo(Width,0);
> Canvas.LineTo(0,Height);
> end;
> end;
>
> Now resize the form with the Mouse.
> For me, the image resizes correctly but the visible area keeps the
> designtime size.
> See: http://www.theo.ch/lazarus/lazimgresize.png
> Is it a bug, or is it "by design"?
By design.
TImage has two canvas, the first is the picture (memory), the second is
on the screen.
During OnPaint Canvas is the screen canvas. Otherwise it is an alias
for the Picture.Canvas.
You can resize the picture by using Image1.Picture.Width:=100.
Mattias
More information about the Lazarus
mailing list