horizontal splitter
-
Hi I am still using VS 2003, and I want to use horizontal splitter in my window form. How can i do that? thanks..
Hello I don't use VS2003 yet i think the splitter control should work fine for you -not the splitcontainer control-. This code is copied from MSDN documentaion with some modifications to make the splitter horizontal as you asked:
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.Bottom; // Set the Splitter to dock to the left side of the TreeView control. splitter1.Dock = DockStyle.Bottom; // 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});
}
So, you add a splitter, and dock the other control to bottom -or top-, then dock your splitter like it, and the other control that will be in the other pane should be docked as fill or as the opposite direction. Regards:rose:
-
Hello I don't use VS2003 yet i think the splitter control should work fine for you -not the splitcontainer control-. This code is copied from MSDN documentaion with some modifications to make the splitter horizontal as you asked:
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.Bottom; // Set the Splitter to dock to the left side of the TreeView control. splitter1.Dock = DockStyle.Bottom; // 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});
}
So, you add a splitter, and dock the other control to bottom -or top-, then dock your splitter like it, and the other control that will be in the other pane should be docked as fill or as the opposite direction. Regards:rose: