Auto resize and position controls upon form's Resize even

  • Thread starter Thread starter helpful sql
  • Start date Start date
H

helpful sql

Hi,
Are there any cool controls that would allow me to automatically resize
and repositions controls on my form when the form is resized at runtime?

Thanks in advance.
 
Hi,
Are there any cool controls that would allow me to automatically resize
and repositions controls on my form when the form is resized at runtime?

Thanks in advance.
 
Check the screen size when the application starts and based on the original
designed screen size, you can ratio the vertical and horizontals. Loop thru
all the controls and resize and relocate those that have the dock property
set to none.
 
Yes, that's the painful way to do it.

The first line of attack should be Dock and Anchor. In .NET 2.0 these
can be used in concert with layout containers like FlowLayoutPanel,
TableLayoutPanel, and SplitContainer.

If you cannot get the effect you want with a combination of these
things, then you have two choices, depending upon the situation:

1) Create your own layout container that does what you want. Lots of
work, but at least you can use it over and over in other projects.

2) Handle the Resize event on the Form and move and reshape your
controls accordingly.

If you have to resort to #2 in .NET 1.1 then that's life. If you have
to resort to #2 in .NET 2.0 then you really have to ask yourself if
it's worth getting that specific effect you're after (hint: it probably
isn't).
 
Back
Top