- use
System.Windows.Forms.SplitContainer MySplitContainer = new System.Windows.Forms.SplitContainer();
-
initialize
1 this .SuspendLayout();
2
3 splitContainer1.SuspendLayout();
4
5 splitContainer1.BorderStyle = BorderStyle.Fixed3D;
6
7 splitContainer1.SplitterIncrement = 7 ;
8
9 SplitContainer horizontalSplitter = new SplitContainer();
10 horizontalSplitter.Name = " horizontal " ;
11 horizontalSplitter.Orientation = Orientation.Horizontal;
12 horizontalSplitter.SuspendLayout();
13 horizontalSplitter.BorderStyle = BorderStyle.FixedSingle;
14
15
16 splitContainer1.Dock = DockStyle.Fill;
17
18 splitContainer1.Panel2.Controls.Add(horizontalSplitter);
19 horizontalSplitter.Dock = DockStyle.Fill;
20
21 splitContainer1.Panel1MinSize = 100 ;
22
23 horizontalSplitter.Panel1.Controls.Add(groupBox1);
24
25 groupBox1.Dock = DockStyle.None;
26
27 splitContainer1.ResumeLayout();
28 horizontalSplitter.ResumeLayout();
29 this .ResumeLayout(); -
Note
When adding several controls to a parent control, it is recommended that you call the SuspendLayout method before initializing the controls to be added. After adding the controls to the parent control, call the ResumeLayout method. This will increase the performance of applications with many controls.
转载于:https://www.cnblogs.com/xuxiaoguang/archive/2007/11/26/972851.html