您的位置:首页 > 其它

.NET2.0 WinForms系列(一)实现窗体切分

2007-11-26 15:53 507 查看
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.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: