splitter如何分隔上下两个PANEL?
this.panel1 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
this.splitter1 = new System.Windows.Forms.Splitter();
this.SuspendLayout();
//
// panel1
//
this.panel1.BackColor = System.Drawing.SystemColors.ActiveCaption;
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.ForeColor = System.Drawing.SystemColors.GradientActiveCaption;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(522, 558);
this.panel1.TabIndex = 0;
//
// panel2
//
this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel2.Location = new System.Drawing.Point(0, 458);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(522, 100);
this.panel2.TabIndex = 1;
//
// splitter1
//
this.splitter1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.splitter1.Location = new System.Drawing.Point(0, 455);
this.splitter1.Name = "splitter1";
this.splitter1.Size = new System.Drawing.Size(522, 3);
this.splitter1.TabIndex = 2;
this.splitter1.TabStop = false;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(522, 558);
this.Controls.Add(this.splitter1);
this.Controls.Add(this.panel2);
this.Controls.Add(this.panel1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Splitter splitter1;
本来设想是,splitter1把上下两个PANEL隔开,现实这样设置是,PANEL1占据了整个FORM,只是下部分被PANEL2遮住不显示而已,如果 this.panel1.Dock = System.Windows.Forms.DockStyle.Top; this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; this.splitter1.Dock = System.Windows.Forms.DockStyle.Top;则可以实现FORM被分开,但不理想的是我想让上面的PANEL随着FORM大小变化而变化,而不是下面这个PANEL
[解决办法]
panel2的dock设置bottom,panel1设置为fill