Login required to post messages or search forums!

 

  Product Support  WinFormResizer for .NET 2.0 Support  Picture box are...
 Picture box are not keeping ratio
 
Dnx
10 posts
Joined
9/22/2006

Picture box are not keeping ratio
Posted: 25 Sep 06 7:56 AM
Hi,

i have an arraylist that contain 10 picturebox (they are drawn like a line)
and for each picturebox when i click on it, i change the height dynamically
something like that :

picturebox.height = dynamicValue

it works on original size but when i resize the form or maximize, the line are too short or too long... it's like the ratio isn't apply on those control

regards 




Support
71 posts
Joined
4/29/2006

Re: Picture box are not keeping ratio
Posted: 25 Sep 06 9:05 AM Modified By Support  on 9/25/2006 9:07:10 AM)

Hello,

WinFormResizer assumes that the "dynamicValue" you specify for height is proportional to the current Form's size unless otherwise told.

For example, if you specify a height of 10 while the Form is maximized, restoring the Form to its normal size will cause the problems you are seeing.

The way to change a PictureBox control's height "manually" at run time is to modify it's InitialSize property:


C#:

// Get a reference to the PictureBox's current InitialSize
Size szInitial = winFormResizer1.Extenders[pictureBox1].ExtendedLayout.InitialSize;


// Set the PictureBox's new height by specifying its new size based on its current initial width and
// new height.
winFormResizer1.Extenders[pictureBox1].ExtendedLayout.InitialSize = new Size(szInitial.Width, NewHeight);


// Update the Target (Form)
winFormResizer1.UpdateTarget();


VB.NET:

' Get a reference to the PictureBox's current InitialSize
Dim szInitial As Size = winFormResizer1.Extenders(pictureBox1).ExtendedLayout.InitialSize


' Set the PictureBox's new height by specifying its new size based on its current initial width and
' new height.
winFormResizer1.Extenders(pictureBox1).ExtendedLayout.InitialSize = new Size(szInitial.Width, NewHeight)


' Update the Target (Form)
winFormResizer1.UpdateTarget()

This link (DnxPictureBoxes.zip) points to a simple VS 2005 (C#) example solution containing 10 picture box controls that have their Sizes manually modified at run time.

Regards,
Fengari Software Support

  Product Support  WinFormResizer for .NET 2.0 Support  Picture box are...
Copyright © 2006-2008 Fengari Software. All rights reserved.   |  Privacy Statement  |  Terms Of Use