Share via


SplitContainer Control Overview (Windows Forms)

The Windows Forms SplitContainer control can be thought of as a composite; it is two panels separated by a movable bar. When the mouse pointer is over the bar, the pointer changes shape to show that the bar is movable.

Important

In the Toolbox, SplitContainer control replaces the Splitter control that was there in the previous version of Visual Studio. The SplitContainer control is much preferred over the Splitter control. The Splitter class is still included in the .NET Framework for compatibility with existing applications, but we strongly encourage you to use the SplitContainer control for new projects.

With the SplitContainer control, you can create complex user interfaces; often, a selection in one panel determines what objects are shown in the other panel. This arrangement is very effective for displaying and browsing information. Having two panels lets you aggregate information in areas, and the bar, or "splitter," makes it easy for users to resize the panels.

More than one SplitContainer control can also be nested, with the second SplitContainer control oriented horizontally, to create top and bottom panels.

Be aware that the SplitContainer control is keyboard-accessible by default; users can press the ARROW keys to move the splitter if the IsSplitterFixed property is set to false.

The Orientation property of the SplitContainer control determines the direction of the splitter, not of the control itself. Hence, when this property is set to Vertical, the splitter runs from top to bottom, creating left and right panels.

Additionally, be aware that the value of the SplitterRectangle property varies depending on the value of the Orientation property. For more information, see SplitterRectangle property.

You can also restrict the size and movement of the SplitContainer control. The FixedPanel property determines which panel will remain the same size after the SplitContainer control is resized, and the IsSplitterFixed property determines if the splitter is movable by the keyboard or mouse.

Note

Even if the IsSplitterFixed property is set to true, the splitter may still be moved programmatically; for example, by using the SplitterDistance property.

Finally, each panel of the SplitContainer control has properties to determine its individual size.

Commonly Used Properties, Methods, and Events

Name

Description

FixedPanel property

Determines which panel will remain the same size after the SplitContainer control is resized.

IsSplitterFixed property

Determines if the splitter can be moved with the keyboard or mouse.

Orientation property

Determines if the splitter is arranged vertically or horizontally.

SplitterDistance property

Determines the distance in pixels from the left or upper edge to the movable splitter bar.

SplitterIncrement property

Determines the minimum distance, in pixels, that the splitter can be moved by the user.

SplitterWidth property

Determines the thickness, in pixels, of the splitter.

SplitterMoving event

Occurs when the splitter is moving.

SplitterMoved event

Occurs when the splitter has moved.

See Also

Reference

SplitContainer

Other Resources

SplitContainer Control (Windows Forms)

SplitContainer Control Sample