Question Auto scaling of controls in a form (.Net 2008).

priyamtheone

Well-known member
Joined
Sep 20, 2007
Messages
96
Programming Experience
Beginner
DESKTOP APPLICATION.

Hi, below is the problem briefed:
In my home form I have a splitcontainer and few buttons. When the buttons are clicked respective forms are opened in the splitcontainer. The splitcontainer is anchored- top, left, right, bottom so that when the home form is resized the splitcontainer resizes itself automatically. The controls within the other forms are also anchored properly to resize themselves accordingly. But the problem is when i open a form in the splitcontainer, even if I resize the home form, the controls in the form within the splitcontainer aren't resizing. The reason is when the home form is resized the splitcontainer is resizing itself accordingly but the form inside the splitcontainer isn't (as forms don't have anchor or dock properties so I couldn't set them). As a result though the controls in the sub form are anchored to resize themselves yet they aren't. How to solve it.

In short I want the form in the splitcontainer and all the controls in it to resize automatically when the home form/splitcontainer is resized. Regards.
 
Never mind! I missed a small property. When you call the subform in the splitcontainer of the main form just set the property Dock to Fill.
dim objFrmSubForm as New frmSubForm()
objFrmSubForm.Dock=DockStyle.Fill
objFrmSubForm.Show()
objFrmSubForm=Nothing

Regards.
 
Back
Top