Click here to Skip to main content
15,918,003 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:

Hi,

I want to create 2(rows) x 2(columns) splitter which will set 4 panels simultaneously.

For example, in MFC as we move center of horizontal & vertical splitter simultaneously, and it set 4 panels accordingly. Previously I had used MFC CSplitterWnd::CreateStatic (4 views for 4 panes). Now I have shifted my MFC Project into C#,

Please inform me as I want to do same thing in C#

Thanks in advance!

Posted
Updated 26-Nov-09 8:08am
v3

As far as I know the built in split container can only have two panels. You can get the 4 panel look you are going for by using three split containers (one horizontal splitter inside each of the vertical parent splitter's panels), but you will have to handle the resizing yourself, to ensure both child splitters are sized at the same time.
 
Share this answer
 
AFAIK, cannot be done by single splitter. Although you can make use of TableLayoutPanel.
 
Share this answer
 

Follow the other answer (one main horizontal splitter and two vertical splitters inside each of the panels, to give you the 4 separate panels).

Then hook up one of the vertical SplitContainer's SplitterMoved events (there may be reasons to use SplitterMoving, I'm not 100% on that. I'd go with SplitterMoved). 

Inside the handler for that event, set the OTHER vertical splitter.SplitterDistance to be the first vertical splitter.SplitterDistance.

You should then be able to have all 4 panels stay in sync. 

 
Share this answer
 
v2
Hi,
I have already used SplitterMoved and SplitterMoving events with splitterDistance and SplitterIncrement functions but the thing is Splitter updates after I release the mouse buttons i.e at a time both doesnt move.

One more thing is, It is a solution for horizontal splitter moving or vertical splitter moving one at a time, Instead I want 4 panels should be updated at a time as we can do it in MFC at the intersection of two splitters.
Thanks!
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900