On Thu, 07 Dec 2006 08:08:23 +0200
Dave Coventry <[EMAIL PROTECTED]> wrote:
> I've added the following lines:
>
> //================ snip =========================
> Image1.Canvas.Width:=Form1.Width;
> Image1.Canvas.Height:=Form1.Height;
> //================ snip =========================
>
> Which produces the following Error Dialog:
> "Project raised exception class 'External SIGFPE'."
>
> Debugger halts at Unit 'LCLProc' , line 786
> //================ snip =========================
> if (length(Msg) div (length(Msg) div 10000))=0 then ;
> //================ snip =========================
>
> I notice in the bug report that the Severity is listed as 'minor',
> but surely TImage is unusable if it can't be resized?
> Well, I suppose you could still use it with non-resizable forms, but
> that would certainly diminish it's usefulness.
See below.
>
> Many Thanks,
>
> Dave Coventry
>
>
> Vincent Snijders wrote:
> > Dave Coventry schreef:
> >> Hi,
> >>
> >> I have a TImage, Image1 on my form.
> >>
> >> I have the following code:
> >> //================ snip =========================
> >> procedure TForm1.FormResize(Sender: TObject);
> >> begin
> >> Image1.Width:=Form1.Width;
> >> Image1.Height:=Form1.Height-98;
> >> Image1.Canvas.Brush.Color:=clBlack;
> >> Image1.Canvas.FillRect(0,0,Image1.Width,Image1.Height);
> >> showmessage('Image width:'+inttostr(Image1.Width)); end;
> >> //================ snip =========================
> >>
> >> The Image1.Width does change size, but the area painted black
> >> remains at the Width specified at design time.
> >>
> >> Can anyone help?
> >>
> >
> > I cannot help, but this sounds familiar:
> > http://www.freepascal.org/mantis/view.php?id=7192
Don't confuse TImage.Canvas and TImage.Picture.Bitmap.Canvas.
The first is the canvas of the image shown on screen, which is painted
everytime the user unhides the control or resizes it. This is only
valid during the OnPaint of Image1. That's why it is not resizeable. It
is resized by the LCL automatically.
The latter is the Bitmap.
For example:
// resize the TImage
Image1.Width:=Form1.Width div 2;
Image1.Height:=Form1.Height div 2;
// resize the bitmap of TImage (this clears it)
Image1.Picture.Bitmap.Width:=Image1.Width;
Image1.Picture.Bitmap.Height:=Image1.Height;
// fill bitmap red
Image1.Picture.Bitmap.Canvas.Brush.Color:=clRed;
Image1.Picture.Bitmap.Canvas.FillRect(0,0,Image1.Width,Image1.Height);
// paint a cross on the bitmap
with Image1.Picture.Bitmap.Canvas do begin
Pen.Color:=clBlue;
Line(0,0,Image1.Width,Image1.Height);
Line(Image1.Width,0,0,Image1.Height);
end;
Mattias
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives