Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Controls / February 2005

Tip: Looking for answers? Try searching our database.

PictureBox.Size - not setting

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
trinitypete - 28 Feb 2005 16:07 GMT
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]


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.