Splitter with 3 panels

  • Thread starter Thread starter Zachary Turner
  • Start date Start date
Z

Zachary Turner

I want to design a Windows Form that basically looks like Windows
Explorer, except at the bottom there is a pane that runs along the
bottom of both the tree view and the list view. What order do I
create everything in, and how should I set the dock styles?

It never seems to work right.

Again, I want it to look like this:

xxxxx|yyyyy
xxxxx|yyyyy
xxxxx|yyyyy
xxxxx|yyyyy
xxxxx|yyyyy
xxxxx|yyyyy
-----------
zzzzzzzzzzz
zzzzzzzzzzz

Thanks
Zach
 
One main panel = pnlBtm
add 2 panels (pnlTop & pnlZ) to pnlBtm
Select dock bottom for pnlZ
Add a splitter called splBtm
Configure splBtm to dock bottom
Configure pnlTop to dock fill
Add 2 panels to pnlTop, pnlX & pnlY
Left dock pnlX
Add splitter and dock it left
Configure pnlY to fill

Seat each panel to a different color for testing. this way it is easy to see
where they lie. Then just play with the bring to front to make sure each sit
within one another. Doing it this was allows you control each panel as a
whole or singly.
 
Hi Zachary,

1. Place the bottom control and dock it Bottom
2. Splitter - dock bottom
3. Left control - dock Left
4. Splitter - dock Left
5. Right control - dock Fill
 
I found this on a french site, not quite what you want but close.

/* CODE */

using System;
using System.Drawing;
using System.Windows.Forms;

public class QuatresPanelsDeuxSplitters : Form
{
private Splitter splitter1;
private Splitter splitter2;
private Panel panel1;
private Panel panel2;
private Panel panel3;
private Panel panel4;
TextBox rtb1;
TextBox rtb2;
TextBox rtb3;

public QuatresPanelsDeuxSplitters()
{
InitializeComponent();
}

private void InitializeComponent()
{
this.splitter1 = new Splitter();
this.splitter2 = new Splitter();
this.panel1 = new Panel();
this.panel2 = new Panel();
this.panel3 = new Panel();
this.panel4 = new Panel();
this.rtb1 = new TextBox();
this.rtb2 = new TextBox();
this.rtb3 = new TextBox();
this.SuspendLayout();
//
// panel1 (en fill)
//
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Resize += new EventHandler(PanelOnResize);
this.panel1.Paint += new PaintEventHandler(PanelOnPaint);
//
// splitter1 (en haut)
//
this.splitter1.Dock = System.Windows.Forms.DockStyle.Top;
//
// panel2 (en haut)
//
this.panel2.Dock = System.Windows.Forms.DockStyle.Top;
this.panel2.Resize += new EventHandler(PanelOnResize);
this.panel2.Paint += new PaintEventHandler(PanelOnPaint);
//
// panel3 (fill sur panel1)
//
this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel3.Resize += new EventHandler(PanelOnResize);
this.panel3.Paint += new PaintEventHandler(PanelOnPaint);
this.panel3.Parent = this.panel1;
//
// splitter2 (a droite de panel3 sur panel1)
//
this.splitter2.Dock = System.Windows.Forms.DockStyle.Right;
this.splitter2.Parent = this.panel1;
//
// panel4 (a droite de splitter 2 sur panel1)
//
this.panel4.Dock = System.Windows.Forms.DockStyle.Right;
this.panel4.Resize += new EventHandler(PanelOnResize);
this.panel4.Paint += new PaintEventHandler(PanelOnPaint);
this.panel4.Parent = this.panel1;
//
// rtb1
//
this.rtb1.Multiline = true;
this.rtb1.Dock = System.Windows.Forms.DockStyle.Fill;
this.rtb1.Parent = this.panel2;
//
// rtb2
//
this.rtb2.Multiline = true;
this.rtb2.Dock = System.Windows.Forms.DockStyle.Fill;
this.rtb2.Parent = this.panel3;
//
// rtb3
//
this.rtb3.Multiline = true;
this.rtb3.Dock = System.Windows.Forms.DockStyle.Fill;
this.rtb3.Parent = this.panel4;
//
// Fenêtre UnPanelUnSplitter
//
this.ClientSize = new System.Drawing.Size(319, 322);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.panel1,
this.splitter1,
this.panel2});
this.Text = "Quatres panels avec deux splitters";
this.ResumeLayout(false);
this.Resize += new EventHandler(PanelOnResize);
this.Paint += new PaintEventHandler(PanelOnPaint);
}

static void Main()
{
Application.Run(new QuatresPanelsDeuxSplitters());
}

void PanelOnResize(object o, EventArgs e)
{
Control control = (Control)o;
control.Invalidate();
}

void PanelOnPaint(object o, PaintEventArgs args)
{
Control panel = (Control)o;
Graphics grfx = args.Graphics;
grfx.DrawLine(Pens.Black, 0, 0, panel.Width-1, panel.Height-1);
grfx.DrawLine(Pens.Black, panel.Width-1, 0, 0, panel.Height-1);
grfx.DrawEllipse(Pens.Black, 0, 0, panel.Width-1, panel.Height-1);
}
}

/* END of CODE */


Hope this helps

Publicjoe
C# Tutorial at http://www.publicjoe.f9.co.uk/csharp/tut.html
C# Snippets at http://www.publicjoe.f9.co.uk/csharp/snip/snippets.html
C# Ebook at http://www.publicjoe.f9.co.uk/csharp/samples/ebook.html
 
I finally got it to work after some toying around. Basically I put the
list view and tree view into a panel, and then left the one window on
the bottom by itself.

Inside the panel, i set tree view dock to left, splityter dock to left,
and list view dock to fill.

I set the second splitter dock to bottom, and the bottom window dock to
bottom.

Confusing how these splitter things work.

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
In Whidbey there is a new control, the SplitterPanel (right name there?),
that is basically two panels that can host your controls along with a splitter
between them. This is most useful since it takes most of the guess work
out of splitter issues like what you've had here.
 
Back
Top