Connecting Tech Pros Worldwide Help | Site Map

automatic resizing

Newbie
 
Join Date: Apr 2008
Posts: 11
#1: Aug 14 '09
Hi all,

I am using an MDI Container for the creation of my app but I need to automatically resize my controls according to the size of the child form.

If I set the Anchor properties of all the controls (a datagridview, a textbox and two buttons), the end result is nowhere near what I actually need cause the items just resize without keeping their positions.

Any ideas please???

Thanks
tlhintoq's Avatar
Moderator
 
Join Date: Mar 2008
Location: Arizona, USA
Posts: 1,743
#2: Aug 14 '09

re: automatic resizing


Use the control's location and size properties.
Place the first control in the upper left corner (or where ever you consider home)
Size it.
Place the next control's location 3 pixels to the right of the first control's bounds.right property.
and so on
and so on
and so on
Familiar Sight
 
Join Date: Jul 2009
Location: Calgary, Alberta, Canada
Posts: 211
#3: Aug 14 '09

re: automatic resizing


Anchor should work, but it's a touch tricky and it depends on what you actually want to accomplish with your control placement.

You've described your datagridview, textbox, and two buttons, but how are they organized and how do they mess up when you move them? I was able to put together a form with those controls and have it resize with everything coming out normally using just anchor, so I'm guessing you've got something different than me?

I have things set up as follows...

DataGridView
TextBox
Button1 Button2

... and anchored as follows...

DataGridView - All edges
TextBox - Left, Right, and Bottom
Button1 and Button2 - Bottom and Right
Reply