Two panels on one form with a Splitter. Works?

G

Guest

I'm trying to set up a form with two panels divided by a Splitter control.

I can make the Splitter work in the situations described in the documentation (Listbox or TreeView on left w/Dock set to Left, Panel on right of form w/ Dock set to Fill, Splitter between them set w/ Dock set to Left. Works as advertised.

But... if I change to have two panels on the form one on the left with Dock set to Left, a panel on the right with Dock set to Fill, and a Splitter w/ Dock set to Left then the form looks great when you run it, and you can access the Splitter (the cursor changes to the "move Splitter" cursor) but I CANNOT drag the Splitter (the panel on the left does not re-size). Is there a setting I'm overlooking, or does the Splitter just not work between two panels?

Thanks. Sorry if this isn't the right group to post to for WinForms questions.
 
S

Shakir Hussain

You may have to play around a little bit with SendToBack button,
BringToFront button in the designer toolbar. Select a panel and change those
options.

Splitter will work even in design mode. You will able to resize panels using
splitter during design mode.

--
Shak
(Houston)


BBM said:
I'm trying to set up a form with two panels divided by a Splitter control.

I can make the Splitter work in the situations described in the
documentation (Listbox or TreeView on left w/Dock set to Left, Panel on
right of form w/ Dock set to Fill, Splitter between them set w/ Dock set to
Left. Works as advertised.
But... if I change to have two panels on the form one on the left with
Dock set to Left, a panel on the right with Dock set to Fill, and a Splitter
w/ Dock set to Left then the form looks great when you run it, and you can
access the Splitter (the cursor changes to the "move Splitter" cursor) but I
CANNOT drag the Splitter (the panel on the left does not re-size). Is
there a setting I'm overlooking, or does the Splitter just not work between
two panels?
 
S

Sijin Joseph

Make sure that in InitializeComponent the controls are being added in this
order

1. panel with fill dock
2. splitter with left dock
3. panel with left dock

--
-Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph


BBM said:
I'm trying to set up a form with two panels divided by a Splitter control.

I can make the Splitter work in the situations described in the
documentation (Listbox or TreeView on left w/Dock set to Left, Panel on
right of form w/ Dock set to Fill, Splitter between them set w/ Dock set to
Left. Works as advertised.
But... if I change to have two panels on the form one on the left with
Dock set to Left, a panel on the right with Dock set to Fill, and a Splitter
w/ Dock set to Left then the form looks great when you run it, and you can
access the Splitter (the cursor changes to the "move Splitter" cursor) but I
CANNOT drag the Splitter (the panel on the left does not re-size). Is
there a setting I'm overlooking, or does the Splitter just not work between
two panels?
 
G

Guest

Thanks for your response.

As far as I can tell, the SendToBack and BringToFront buttons only affect the way controls look in the Designer. My problem (I think) was in that I was not putting the controls on the design surface in the correct order. I got it to work by putting the controls on the surface in this order...

1) Added Panel1 with Dock set to Left (width about 1/3 of the form),
2) Dropped Splitter to right of Panel1 and set Dock to Left,
3) Dropped Panel2 in area to right of Panel1 and set Dock to Fill.

When I run this form, the Splitter now controls the size of the two panels.

You are right in that unless Panel2 is set to BringToFront you cannot see the Splitter. I couldn't get the Splitter to work in Design Mode though. I'm using the standard WinForms controls.

Thanks for your help.
 
G

Guest

Shakir:

I owe you an apology. You are correct, you can affect the behavior of the
panels separated by a Splitter using SendToBack / BringToFront. The splitter
needs to know the "docking priority" to decide which control "owns" the
common edge to which the controls are docked. For some reason the "docking
priority" is the REVERSE of the z-order (depth) of the control on the design
surface. You control the z-order by using the SendToBack / BringToFront
buttons. Using BringToFront sets z-order to zero, which makes it the LOWEST
docking priority. Other controls with a higher z-order will squeeze the one
with the lowest z-order when the Splitter is moved.

Thanks for your help.

BBM
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Usercontrol Panel Splitter 2
splitter control 2
splitter problems 7
IDE - Control /Docking Ordering Issue? 1
How to use SPLITTER ? 3
Splitter between panels 1
Splitter and panels 1
multiple splitter controls 5

Top