The Why and How of the SplitContainer Control - Docking and Anchoring of Controls
(Page 3 of 6 )
One of the common properties of controls is the Dock property. This property shows to which of the four sides the control is docked, or whether it "fills" the parent as shown by the design time "dock" setting, or whether the control is not docked at all. You make these choices by clicking on the appropriate button in the Properties window. The Anchor property on the other hand defines to which edges of a container the control contained therein is bound.

Since the SplitContainer control is basically related to layout as explained earlier, the dock and anchor properties of the controls it contains in its panels are important. For example when the splitter resizes the panels, depending on whether or not the controls are properly set with regard to "dock" and "anchor," it is possible to make them adjust automatically while resizing the panels, or obscure them.
Anchored Text boxes in Panels
While looking at properties it is enough to right click inside the control to review the properties or make changes to the properties. For the SplitContainer right click on any of the panels and from the drop-down choose Select SplitContainer1 to review its properties. In the same drop-down you may also choose the form which is underneath the SplitContainer.
The setting of the text boxes in the design view of the following form with a SplitContainer shown are as follows:
Textbox1 in SplitContainer1.Panel1
Anchor: Top, Left (default)
Dock None
Size: 100, 74
WordWrap: True
MultiLine: True
ScrollBars: Vertical
Textbox2 in SpliterContainer1.Panel2
Anchor: Top, Right
Dock None
Size: 100,82
WordWrap: True
MultiLine: True
ScrollBars :Vertical

When this project is built and the Docking form is run the form will be displayed as shown with the Splitter dragged to the left.

When the splitter is dragged to the right, the resizing makes the following change to the display. The obscuring of the text in the text boxes is easy to see.

Next: Anchoring to prevent obscuring >>
More .NET Articles
More By Jayaram Krishnaswamy