Split a form into 3 or 4 parts.

emi_sastra
emi_sastra used Ask the Experts™
on
Hi All,

I want split windows form into 3 or 4 parts.
I also want those parts will resize automatically when its form is resized.

How could I do it ?

Thank you.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
ǩa̹̼͍̓̂ͪͤͭ̓u͈̳̟͕̬ͩ͂̌͌̾̀ͪf̭̤͉̅̋͛͂̓͛̈m̩̘̱̃e͙̳͊̑̂ͦ̌ͯ̚d͋̋ͧ̑ͯ͛̉Glanced up at my screen and thought I had coded the Matrix...  Turns out, I just fell asleep on the keyboard.
Most Valuable Expert 2011
Top Expert 2015

Commented:
Have you tried a TableLayoutPanel? You can dock the panel to the form so it fills the working region, then add three panels to the TableLayoutPanel, putting each in a different cell and docking it to the cell. Set the RowSpan/ColumnSpan property for the panel which you would like to be the larger panel.
untitled.JPG
Glanced up at my screen and thought I had coded the Matrix...  Turns out, I just fell asleep on the keyboard.
Most Valuable Expert 2011
Top Expert 2015
Commented:
By "three panels" above I mean three regular panels, not another three TableLayoutPanels :)

Author

Commented:
Hi kaufmed,

It is interesting.

Let me try first.

Thank you.
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

ǩa̹̼͍̓̂ͪͤͭ̓u͈̳̟͕̬ͩ͂̌͌̾̀ͪf̭̤͉̅̋͛͂̓͛̈m̩̘̱̃e͙̳͊̑̂ͦ̌ͯ̚d͋̋ͧ̑ͯ͛̉Glanced up at my screen and thought I had coded the Matrix...  Turns out, I just fell asleep on the keyboard.
Most Valuable Expert 2011
Top Expert 2015

Commented:
No problem  :)

Author

Commented:
I have tried it.

I use one TableLayoutPanel and three panels (groupbox plus panel).

It works.

Just curios why you suggest TableLayoutPanel, not SplitContainer ?

Thank you.
ǩa̹̼͍̓̂ͪͤͭ̓u͈̳̟͕̬ͩ͂̌͌̾̀ͪf̭̤͉̅̋͛͂̓͛̈m̩̘̱̃e͙̳͊̑̂ͦ̌ͯ̚d͋̋ͧ̑ͯ͛̉Glanced up at my screen and thought I had coded the Matrix...  Turns out, I just fell asleep on the keyboard.
Most Valuable Expert 2011
Top Expert 2015

Commented:
I think either would do, but I knew that TableLayoutPanel would give you the option of Row/Column spanning. You could still achive the same thing with SplitContainer. Also, SplitContainer would allow the user to resize the panels using the "splitter". You can, of course, disable this, but if that is something you are after, then I would probably go the SplitContainer route. Just nest a SplitContainer inside of another to achive 3 sections.

Author

Commented:
Would you please guide me how to split SplitContainer into three parts (top, middle and bottom) ?
I have tried it before but failed to do so.

Thank you.
ǩa̹̼͍̓̂ͪͤͭ̓u͈̳̟͕̬ͩ͂̌͌̾̀ͪf̭̤͉̅̋͛͂̓͛̈m̩̘̱̃e͙̳͊̑̂ͦ̌ͯ̚d͋̋ͧ̑ͯ͛̉Glanced up at my screen and thought I had coded the Matrix...  Turns out, I just fell asleep on the keyboard.
Most Valuable Expert 2011
Top Expert 2015
Commented:
Hmmm...

I was on a different line of thinking. So you want a form with 3 horizontal sections. I personally would stick with TableLayoutPanel and just give it 3 rows and no columns, but since you asked for SplitContainer...

Add a SplitContainer to your form and dock it to the form, if not already. Then choose on of either of its panels and add another SplitContainer to it, docking it to that panel. Like:
untitled.JPG

Author

Commented:
I have tried, it becomes three part, but in vertical not horizontal?

Thank you.
ǩa̹̼͍̓̂ͪͤͭ̓u͈̳̟͕̬ͩ͂̌͌̾̀ͪf̭̤͉̅̋͛͂̓͛̈m̩̘̱̃e͙̳͊̑̂ͦ̌ͯ̚d͋̋ͧ̑ͯ͛̉Glanced up at my screen and thought I had coded the Matrix...  Turns out, I just fell asleep on the keyboard.
Most Valuable Expert 2011
Top Expert 2015

Commented:
Oh, sorry about that. If you select each SplitContainer, you will find a Property called "Orientation." Change that from Vertical to Horizontal.

Author

Commented:
It works.

Now, I have two options control to be use (SplitContainer  and TableLayoutPanel).

Thank you very much for your help.

ǩa̹̼͍̓̂ͪͤͭ̓u͈̳̟͕̬ͩ͂̌͌̾̀ͪf̭̤͉̅̋͛͂̓͛̈m̩̘̱̃e͙̳͊̑̂ͦ̌ͯ̚d͋̋ͧ̑ͯ͛̉Glanced up at my screen and thought I had coded the Matrix...  Turns out, I just fell asleep on the keyboard.
Most Valuable Expert 2011
Top Expert 2015

Commented:
NP. Sorry for the initial confusion, but glad it ultimately worked out for you :)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial