Hi. I have spent the better half of the day tring to get this splitter to work on my form. not sure what i am doing wrong. i have 2 panels, each with components on them. I want the splitter to rest between each panel. Also, is there a way that C# provides to make this splitter "clickable"?? THanks much in advance, code below:
public class MyForm : System.Windows.Forms.Form
{
private Panel leftpanel;
private Panel rightpanel;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.StatusBar statusBar1;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.RichTextBox richTextBox2;
private System.Windows.Forms.TreeView treeView2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Splitter splitter1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public MyForm()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.leftpanel = new System.Windows.Forms.Panel();
this.label1 = new System.Windows.Forms.Label();
this.richTextBox2 = new System.Windows.Forms.RichTextBox();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.button1 = new System.Windows.Forms.Button();
this.rightpanel = new System.Windows.Forms.Panel();
this.treeView2 = new System.Windows.Forms.TreeView();
this.statusBar1 = new System.Windows.Forms.StatusBar();
this.splitter1 = new System.Windows.Forms.Splitter();
this.leftpanel.SuspendLayout();
this.rightpanel.SuspendLayout();
this.SuspendLayout();
//
// leftpanel
//
this.leftpanel.Anchor = System.Windows.Forms.AnchorStyles.None;
this.leftpanel.BackColor = System.Drawing.Color.Aqua;
this.leftpanel.Controls.Add(this.label1);
this.leftpanel.Controls.Add(this.richTextBox2);
this.leftpanel.Controls.Add(this.richTextBox1);
this.leftpanel.Controls.Add(this.button1);
this.leftpanel.Location = new System.Drawing.Point(0, 0);
this.leftpanel.Name = "leftpanel";
this.leftpanel.Size = new System.Drawing.Size(312, 328);
this.leftpanel.TabIndex = 0;
//
// label1
//
this.label1.BackColor = System.Drawing.Color.Aqua;
this.label1.Location = new System.Drawing.Point(0, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(288, 24);
this.label1.TabIndex = 8;
this.label1.Text = "Support for: Microsoft: Windows";
//
// richTextBox2
//
this.richTextBox2.Location = new System.Drawing.Point(16, 32);
this.richTextBox2.Name = "richTextBox2";
this.richTextBox2.Size = new System.Drawing.Size(296, 240);
this.richTextBox2.TabIndex = 7;
this.richTextBox2.Text = "";
//
// richTextBox1
//
this.richTextBox1.Location = new System.Drawing.Point(8, 278);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(232, 40);
this.richTextBox1.TabIndex = 6;
this.richTextBox1.Text = "";
//
// button1
//
this.button1.Location = new System.Drawing.Point(248, 280);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(56, 40);
this.button1.TabIndex = 5;
this.button1.Text = "Send";
//
// rightpanel
//
this.rightpanel.Anchor = System.Windows.Forms.AnchorStyles.None;
this.rightpanel.BackColor = System.Drawing.Color.Beige;
this.rightpanel.Controls.Add(this.treeView2);
this.rightpanel.Location = new System.Drawing.Point(322, 0);
this.rightpanel.Name = "rightpanel";
this.rightpanel.Size = new System.Drawing.Size(184, 320);
this.rightpanel.TabIndex = 1;
//
// treeView2
//
this.treeView2.ImageIndex = -1;
this.treeView2.Location = new System.Drawing.Point(8, 8);
this.treeView2.Name = "treeView2";
this.treeView2.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
new System.Windows.Forms.TreeNode("NodeA", new System.Windows.Forms.TreeNode[] {
new System.Windows.Forms.TreeNode("ChildA"),
new System.Windows.Forms.TreeNode("ChildB")}),
new System.Windows.Forms.TreeNode("NodeB", new System.Windows.Forms.TreeNode[] {
new System.Windows.Forms.TreeNode("NodeC"),
new System.Windows.Forms.TreeNode("ChildB")}),
new System.Windows.Forms.TreeNode("NodeC", new System.Windows.Forms.TreeNode[] {
new System.Windows.Forms.TreeNode("ChildC"),
new System.Windows.Forms.TreeNode("ChildX")}),
new System.Windows.Forms.TreeNode("NodeE"),
new System.Windows.Forms.TreeNode("NodeF"),
new System.Windows.Forms.TreeNode("NodeG"),
new System.Windows.Forms.TreeNode("NodeH")});
this.treeView2.SelectedImageIndex = -1;
this.treeView2.Size = new System.Drawing.Size(168, 304);
this.treeView2.TabIndex = 0;
//
// statusBar1
//
this.statusBar1.Location = new System.Drawing.Point(8, 327);
this.statusBar1.Name = "statusBar1";
this.statusBar1.Size = new System.Drawing.Size(512, 22);
this.statusBar1.TabIndex = 2;
this.statusBar1.Text = "statusBar1";
//
// splitter1
//
this.splitter1.BackColor = System.Drawing.SystemColors.Desktop;
this.splitter1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.splitter1.Dock = System.Windows.Forms.DockStyle.Right;
this.splitter1.Location = new System.Drawing.Point(308, 0);
this.splitter1.Name = "splitter1";
this.splitter1.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.splitter1.Size = new System.Drawing.Size(12, 349);
this.splitter1.TabIndex = 2;
this.splitter1.TabStop = false;
//
// MyForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(520, 349);
this.Controls.Add(this.leftpanel);
this.Controls.Add(this.splitter1);
this.Controls.Add(this.rightpanel);
this.Name = "MyForm";
this.Text = "MyForm";
this.leftpanel.ResumeLayout(false);
this.rightpanel.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
}
}
public class MyForm : System.Windows.Forms.Form
{
private Panel leftpanel;
private Panel rightpanel;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.StatusBar statusBar1;
private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.RichTextBox richTextBox2;
private System.Windows.Forms.TreeView treeView2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Splitter splitter1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public MyForm()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.leftpanel = new System.Windows.Forms.Panel();
this.label1 = new System.Windows.Forms.Label();
this.richTextBox2 = new System.Windows.Forms.RichTextBox();
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.button1 = new System.Windows.Forms.Button();
this.rightpanel = new System.Windows.Forms.Panel();
this.treeView2 = new System.Windows.Forms.TreeView();
this.statusBar1 = new System.Windows.Forms.StatusBar();
this.splitter1 = new System.Windows.Forms.Splitter();
this.leftpanel.SuspendLayout();
this.rightpanel.SuspendLayout();
this.SuspendLayout();
//
// leftpanel
//
this.leftpanel.Anchor = System.Windows.Forms.AnchorStyles.None;
this.leftpanel.BackColor = System.Drawing.Color.Aqua;
this.leftpanel.Controls.Add(this.label1);
this.leftpanel.Controls.Add(this.richTextBox2);
this.leftpanel.Controls.Add(this.richTextBox1);
this.leftpanel.Controls.Add(this.button1);
this.leftpanel.Location = new System.Drawing.Point(0, 0);
this.leftpanel.Name = "leftpanel";
this.leftpanel.Size = new System.Drawing.Size(312, 328);
this.leftpanel.TabIndex = 0;
//
// label1
//
this.label1.BackColor = System.Drawing.Color.Aqua;
this.label1.Location = new System.Drawing.Point(0, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(288, 24);
this.label1.TabIndex = 8;
this.label1.Text = "Support for: Microsoft: Windows";
//
// richTextBox2
//
this.richTextBox2.Location = new System.Drawing.Point(16, 32);
this.richTextBox2.Name = "richTextBox2";
this.richTextBox2.Size = new System.Drawing.Size(296, 240);
this.richTextBox2.TabIndex = 7;
this.richTextBox2.Text = "";
//
// richTextBox1
//
this.richTextBox1.Location = new System.Drawing.Point(8, 278);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(232, 40);
this.richTextBox1.TabIndex = 6;
this.richTextBox1.Text = "";
//
// button1
//
this.button1.Location = new System.Drawing.Point(248, 280);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(56, 40);
this.button1.TabIndex = 5;
this.button1.Text = "Send";
//
// rightpanel
//
this.rightpanel.Anchor = System.Windows.Forms.AnchorStyles.None;
this.rightpanel.BackColor = System.Drawing.Color.Beige;
this.rightpanel.Controls.Add(this.treeView2);
this.rightpanel.Location = new System.Drawing.Point(322, 0);
this.rightpanel.Name = "rightpanel";
this.rightpanel.Size = new System.Drawing.Size(184, 320);
this.rightpanel.TabIndex = 1;
//
// treeView2
//
this.treeView2.ImageIndex = -1;
this.treeView2.Location = new System.Drawing.Point(8, 8);
this.treeView2.Name = "treeView2";
this.treeView2.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
new System.Windows.Forms.TreeNode("NodeA", new System.Windows.Forms.TreeNode[] {
new System.Windows.Forms.TreeNode("ChildA"),
new System.Windows.Forms.TreeNode("ChildB")}),
new System.Windows.Forms.TreeNode("NodeB", new System.Windows.Forms.TreeNode[] {
new System.Windows.Forms.TreeNode("NodeC"),
new System.Windows.Forms.TreeNode("ChildB")}),
new System.Windows.Forms.TreeNode("NodeC", new System.Windows.Forms.TreeNode[] {
new System.Windows.Forms.TreeNode("ChildC"),
new System.Windows.Forms.TreeNode("ChildX")}),
new System.Windows.Forms.TreeNode("NodeE"),
new System.Windows.Forms.TreeNode("NodeF"),
new System.Windows.Forms.TreeNode("NodeG"),
new System.Windows.Forms.TreeNode("NodeH")});
this.treeView2.SelectedImageIndex = -1;
this.treeView2.Size = new System.Drawing.Size(168, 304);
this.treeView2.TabIndex = 0;
//
// statusBar1
//
this.statusBar1.Location = new System.Drawing.Point(8, 327);
this.statusBar1.Name = "statusBar1";
this.statusBar1.Size = new System.Drawing.Size(512, 22);
this.statusBar1.TabIndex = 2;
this.statusBar1.Text = "statusBar1";
//
// splitter1
//
this.splitter1.BackColor = System.Drawing.SystemColors.Desktop;
this.splitter1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.splitter1.Dock = System.Windows.Forms.DockStyle.Right;
this.splitter1.Location = new System.Drawing.Point(308, 0);
this.splitter1.Name = "splitter1";
this.splitter1.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.splitter1.Size = new System.Drawing.Size(12, 349);
this.splitter1.TabIndex = 2;
this.splitter1.TabStop = false;
//
// MyForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(520, 349);
this.Controls.Add(this.leftpanel);
this.Controls.Add(this.splitter1);
this.Controls.Add(this.rightpanel);
this.Name = "MyForm";
this.Text = "MyForm";
this.leftpanel.ResumeLayout(false);
this.rightpanel.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
}
}