Splitter Constructor ()
.NET Framework (current version)
Initializes a new instance of the Splitter class. Splitter has been replaced by SplitContainer, and is provided only for compatibility with previous versions.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
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 = gcnew TreeView; ListView^ listView1 = gcnew ListView; Splitter^ splitter1 = gcnew 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. array<Control^>^temp0 = {listView1,splitter1,treeView1}; this->Controls->AddRange( temp0 ); }
.NET Framework
Available since 1.1
Available since 1.1
Show: