First panel created and Dock to the left of the form
Added spliter in to the form side so it Docks on the left
Added Panel 2 and Dock it to the top of the first panel
Added Spliter under Panel 2 and Dock it to to the top
One thing I found is that if the spilter does not have both boxes on either side of the line then the spliter will not work when run.
I hope this may help others just starting out like I'm am.
Marty
Here is the code.
using
System;using
System.Windows.Forms;namespace
DockTest{
///{
private System.Windows.Forms.Splitter splitter2; private System.Windows.Forms.Splitter splitter1; private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Panel panel2; ///{
// // Required for Windows Form Designer support //InitializeComponent();
// // TODO: Add any constructor code after InitializeComponent call //}
///{
if( disposing ){
if (components != null){
components.Dispose();
}
}
base.Dispose( disposing );}
#region
Windows Form Designer generated code ///{
this.splitter2 = new System.Windows.Forms.Splitter(); this.splitter1 = new System.Windows.Forms.Splitter(); this.panel1 = new System.Windows.Forms.Panel(); this.panel2 = new System.Windows.Forms.Panel(); this.panel2.SuspendLayout(); this.SuspendLayout(); // // splitter2 // this.splitter2.BackColor = System.Drawing.Color.Blue; this.splitter2.Location = new System.Drawing.Point(208, 0); this.splitter2.Name = "splitter2"; this.splitter2.Size = new System.Drawing.Size(8, 414); this.splitter2.TabIndex = 2; this.splitter2.TabStop = false; // // splitter1 // this.splitter1.BackColor = System.Drawing.Color.Brown; this.splitter1.Dock = System.Windows.Forms.DockStyle.Top; this.splitter1.Location = new System.Drawing.Point(0, 176); this.splitter1.Name = "splitter1"; this.splitter1.Size = new System.Drawing.Size(208, 8); this.splitter1.TabIndex = 3; this.splitter1.TabStop = false; // // panel1 // this.panel1.Dock = System.Windows.Forms.DockStyle.Top; this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(208, 176); this.panel1.TabIndex = 2; // // panel2 // this.panel2.Controls.Add(this.splitter1); this.panel2.Controls.Add(this.panel1); this.panel2.Dock = System.Windows.Forms.DockStyle.Left; this.panel2.Location = new System.Drawing.Point(0, 0); this.panel2.Name = "panel2"; this.panel2.Size = new System.Drawing.Size(208, 414); this.panel2.TabIndex = 1; this.panel2.Paint += new System.Windows.Forms.PaintEventHandler(this.panel2_Paint); // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(560, 414); this.Controls.Add(this.splitter2); this.Controls.Add(this.panel2); this.Name = "Form1"; this.Text = "Form1"; this.TopMost = true; this.Load += new System.EventHandler(this.Form1_Load); this.panel2.ResumeLayout(false); this.ResumeLayout(false);}
#endregion
///[STAThread]
static void Main(){
Application.Run(
new Form1());}
private void Form1_Load(object sender, System.EventArgs e){
}
private void panel2_Paint(object sender, System.Windows.Forms.PaintEventArgs e){
}
}
}
Replies
Know the answer? Post it — somebody with the same question will find it here.