Home > Articles > Programming > Windows Programming

  • Print
  • + Share This
Like this article? We recommend

Like this article? We recommend

SplitContainer (replaces Splitter)

The SplitContainer control does just what its name implies; it splits the client area of an application into two separate areas. A bar between the two areas lets you decide how much space to allot to each area. The control supports just two panes, and you can split the client area either vertically or horizontally. Figure 7 shows a client area split vertically and horizontally.

Figure 7

Figure 7 The SplitContainer control provides separate areas for content within your application.

To achieve this effect, you begin by placing a SplitContainer control onto the form and docking it to fill the entire form. After you place the first SplitContainer control, place a second one on the right side. Set the Dock property to Fill. However, instead of filling the entire form, the second control fills just the right side. Set the Orientation property to Horizontal. Now all you need to do is fill the three separate areas with controls.

This example will eventually show a tree view of a hard drive in the left pane, a list view of the selected directory in the upper-right pane, and details about the selected file in the lower pane. However, this particular setup comes in handy for a number of tasks. The advantage of using this control is that you don’t have to add a single line of code to make it work. All you need to do is set a few properties, and the areas are ready for use. Using this control makes creating areas simple and limits the associated programming to just the controls you would normally need to program in the first place.

  • + Share This
  • 🔖 Save To Your Account