|
Win Form 的 Splitter 使用心得(2) 1、放入一个 Panel 比如:panel1 然后设置他的 Dock 属性为:Left; 2、放入一个 Splitter 比如:splitter1 设置它的背景颜色为一个特殊的颜色,便于看执行效果; 3、放入一个 Panel 比如:panel2 然后设置他的 Dock 属性为:Fill; 4、编译执行程序,这时候就没有问题了。 这时候正确的代码应该是:( InitializeComponent 函数部分) private void InitializeComponent(){//// ... 其他代码//this.panel1 = new System.Windows.Forms.Panel();this.panel2 = new System.Windows.Forms.Panel();this.splitter1 = new System.Windows.Forms.Splitter();this.panel2.SuspendLayout();this.SuspendLayout();//// ... 其他代码//// // panel1// this.panel1.Dock = System.Windows.Forms.DockStyle.Left;this.panel1.Location = new System.Drawing.Point(0, 42);this.panel1.Name = "panel1";this.panel1.Size = new System.Drawing.Size(200, 209);this.panel1.TabIndex = 6;// // panel2// this.panel2.Controls.Add(this.splitter1);this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;this.panel2.Location = new System.Drawing.Point(200, 42);this.panel2.Name = "panel2";this.panel2.Size = new System.Drawing.Size(248, 209);this.panel2.TabIndex = 7;// // splitter1// this.splitter1.BackColor = System.Drawing.SystemColors.Desktop;this.splitter1.Location = new System.Drawing.Point(0, 0);this.splitter1.Name = "splitter1";this.splitter1.Size = new System.Drawing.Size(3, 209);this.splitter1.TabIndex = 0;this.splitter1.TabStop = false;// // Form1// this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);this.ClientSize = new System.Drawing.Size(448, 273);this.Controls.Add(this.panel2);this.Controls.Add(this.panel1);this.Controls.Add(this.toolBar1);this.Controls.Add(this.statusBar1);this.Menu = this.mainMenu1;this.Name = "Form1";this.Text = "站点下载工具 2003年9月21日";this.Load += new System.EventHandler(this.Form1_Load);this.panel2.ResumeLayout(false);this.ResumeLayout(false);}我程序的执行环境是 win2003 标准英文版 VS.net 2003 中文版
|