Hi all,
I have a windows form where I am using a PictureBox with an image.
The picture box is created at design time with a specified image. The
picture box is anchor bottom left, and set to autosize.
During a mouseenter, I want to enlarge the image and on mouseleave put back
to normal size. Here is the mouse enter code.
((PictureBox)(sender)).SizeMode = PictureBoxSizeMode.AutoSize;
Size newsize = new Size(((PictureBox)(sender)).Size.Width +
20,((PictureBox)(sender)).Size.Height + 20);
((PictureBox)(sender)).Size = newsize;
If I break on ((PictureBox)(sender)).Size = newsize and step to the next
line, the newsize is reflected in the newsize member, but the picturebox size
is not effected.
Any ideas,
Pete.
trinitypete - 28 Feb 2005 16:19 GMT
OK I got it, needed the Sizemode to set to stretch. The Picture box was set
to autosize, therefore always resizing to image sixe. Increasing the size of
the picturebox has no effect as it will again resize to the image.
Pete.
> Hi all,
>
[quoted text clipped - 18 lines]
>
> Pete.
Morten Wennevik - 28 Feb 2005 16:32 GMT
Indeed,
Also, with Framework 2.0 a new SizeMode will allow stretch to fit while
retaining the aspect ratio.

Signature
Happy Coding!
Morten Wennevik [C# MVP]