MS的例子,你直接放到private void Form1_Load(object sender, System.EventArgs e)里面执行,就会看到了。
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});
}
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});
}
解决方案 »
- Image转Stream转Byte[],Byte[]转Stream转Image,参数无效
- winform问题
- GDI+如何测量字符串所占像素?
- 应用程序相关问题
- 请问.NET工程师需要掌握哪几门技术????
- 如何实现窗口被点出后,其他窗口全部enable=false??
- 为各位朋友 C#操作EXCEL 方法中有没有删除EXCEL 中数据 高效的删除方法
- RichBox中的字体颜色要求 一行蓝色的,一行红色的,怎么设置?
- 12个串口,同一时间段要打开至少五六个串口,每个串口每隔十几毫秒接收一帧数据,如何存入oracle数据库中?
- 为什么我使用VS·NET粘贴为HTML代码时,源代码总是自动的被添加了一些其它们的代码
- 小问题,请大家帮帮忙
- 急!(等...)
添加一个panel,将它的dock属性设置为left,然后添加splitter,将它的dock属性也设置为left,就可以实现你说的功能了,呵呵