Export (0) Print
Expand All

Splitter.MinExtra Property

Gets or sets the minimum distance that must remain between the splitter control and the edge of the opposite side of the container (or the closest control docked to that side). Splitter.MinExtra has been replaced by similar properties in System.Windows.Forms.SplitContainer and is provided only for compatibility with previous versions.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public int MinExtra { get; set; }

Property Value

Type: System.Int32
The minimum distance, in pixels, between the Splitter control and the edge of the opposite side of the container (or the closest control docked to that side). The default is 25.

For a horizontal Splitter control (a Splitter control docked to the top or bottom of a container), the minimum height of the area of the container reserved for undocked controls is this value minus the height of the Splitter control. For a vertical Splitter control (a Splitter control docked to the left or right of a container), the minimum width of the area of the container reserved for undocked controls is this value minus the width of the Splitter control. The user cannot move the splitter past the limit specified by this property.

NoteNote

If the MinExtra property is set to a negative value, the property value is reset to 0.

The following code example uses a Splitter control in combination with TreeView and ListView controls to create a window similar to Windows Explorer. To identify the TreeView and ListView controls, nodes and items are added to both controls. The example uses the MinExtra and MinSize properties of the Splitter to prevent the TreeView or ListView control from being sized too small or too large. This example requires that the method created in this example is defined within a Form and that the method is called from the constructor of the Form.

		private void CreateMySplitControls()
		{
			// Create TreeView, ListView, and Splitter controls.
			TreeView treeView1 = new TreeView();
			ListView listView1 = new ListView();
			Splitter splitter1 = new Splitter();

			// Set the TreeView control to dock to the left side of the form.
			treeView1.Dock = DockStyle.Left;
			// Set the Splitter to dock to the left side of the TreeView control.
			splitter1.Dock = DockStyle.Left;
			// Set the minimum size the ListView control can be sized to.
			splitter1.MinExtra = 100;
			// Set the minimum size the TreeView control can be sized to.
			splitter1.MinSize = 75;
			// Set the ListView control to fill the remaining space on the form.
			listView1.Dock = DockStyle.Fill;
			// Add a TreeView and a ListView item to identify the controls on the form.
            treeView1.Nodes.Add("TreeView Node");
            listView1.Items.Add("ListView Item");

			// Add the controls in reverse order to the form to ensure proper location. 
			this.Controls.AddRange(new Control[]{listView1, splitter1, treeView1});
		}

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft