How do I make parent forms resize according to its fixed-size controls in VB.NET?

I'm building an application in which multiple UserControls are nested within each other as well the main form of the application.

I want the application form to have an initial size set (which is no problem). However whenever a UserControl with dimensions that cannot fit the content panel its added, all parent forms/usercontrols should resize (grow) to accommodate this "large" control. Optimally I would like to implement this behavior by setting control properties in the VS2010 designer if possible.

I have tried fiddling with AutoSize as well code triggered when controls are added that adjusts the parent control to the size of the child control added, but I can't seem to make it work.

What is the best way to implement the above functionality, and what do I miss, since it wont work?
andreas_rafnAsked:
Who is Participating?
 
CodeCruiserConnect With a Mentor Commented:
The only way I know of would be to manually adjust the size of different containers and form based on size of the added control. Its easier to adjust the controls based on form size using anchor and dock properties but I am not aware of a way of doing it vice versa easily.
0
 
Mike TomlinsonConnect With a Mentor Middle School Assistant TeacherCommented:
Agreed.  You'd have to manually code the containers to grow to accommodate the newly added control.
0
 
andreas_rafnAuthor Commented:
Thanks for the input. In light of that I've decided to rethink and redesign the layout so that no automatic increase of size is needed, which is probably a better solution.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.