System.Windows.Forms.Splitter Class

Represents a splitter control that enables the user to resize docked controls. System.Windows.Forms.Splitter has been replaced by System.Windows.Forms.SplitContainer and is provided only for compatibility with previous versions.

See Also: Splitter Members

Syntax

[System.ComponentModel.DefaultProperty("Dock")]
[System.ComponentModel.Designer("System.Windows.Forms.Design.SplitterDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
[System.ComponentModel.DefaultEvent("SplitterMoved")]
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
public class Splitter : Control

Remarks

The System.Windows.Forms.Splitter control enables the user to resize controls that are docked to the edges of the System.Windows.Forms.Splitter control at run time. When the user passes the mouse pointer over the System.Windows.Forms.Splitter control, the cursor changes to indicate that the controls docked to the System.Windows.Forms.Splitter control can be resized. The System.Windows.Forms.Splitter control enables the user to resize the docked control that is immediately before it in the docking order. Therefore, to enable the user to resize a docked control, dock the control you want the user to be able to resize to an edge of a container, and then dock a splitter to the same side of that container. For example, to create a window similar to Windows Explorer, add a System.Windows.Forms.TreeView control to a form and set its Control.Dock property to DockStyle.Left. Add a System.Windows.Forms.Splitter control to the form and set its Control.Dock property to DockStyle.Left as well. To complete the form layout, add a System.Windows.Forms.ListView control and set its Control.Dock property to DockStyle.Fill to have the System.Windows.Forms.ListView occupy the remaining space on the form. At run time, the user can then resize the width of the System.Windows.Forms.TreeView control (as well as the System.Windows.Forms.ListView control) by moving the System.Windows.Forms.Splitter control.

To ensure that the System.Windows.Forms.Splitter control does not resize controls docked to a size that is too small to be useful to the user, you use the Splitter.MinExtra and Splitter.MinSize properties. The Splitter.MinExtra and Splitter.MinSize properties determine the minimum size that controls docked to the left and right (or top and bottom if a horizontal System.Windows.Forms.Splitter control) can be sized to. If the other controls on your form that the System.Windows.Forms.Splitter control is docked to display a specific style of border, you can use the Splitter.BorderStyle property to match the border style of the controls that are docked to it.

You might want to set a maximum size limit on controls that the System.Windows.Forms.Splitter control is docked to. The Splitter.SplitterMoved and Splitter.SplitterMoving events enable you to determine when the user is resizing a docked control. You can use the Splitter.SplitPosition property in an event handler for the Splitter.SplitterMoved or Splitter.SplitterMoving events to determine the size of the control that the System.Windows.Forms.Splitter control is docked to and set the Splitter.SplitPosition property to a different value to limit the docked control's width to a specified maximum width (or height if a horizontally aligned System.Windows.Forms.Splitter control).

Note:

Resizing a control using the System.Windows.Forms.Splitter control can only be done using the mouse. It is not possible to access the System.Windows.Forms.Splitter control using the keyboard.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0