Collapse 'button' for splitcontainer control

Tom picture Tom · Jun 17, 2011 · Viewed 22.5k times · Source

I'm using Microsoft's SplitContainer control in my WinForms desktop application.

I'd like to have a small button (or any nice UI element) between the panels of the splitter control to collapse one of the panels. E.g. a 'button' with two parts, if I click one part, the right side panel collapses, if I click on the other part, the left side panel collapses.

Is this possible? How could that be implemented?

Answer

CharithJ picture CharithJ · Jun 17, 2011

You will have to write your own event for that. You have to decide the design. Hope you need something like below.

private void radButton1_Click(object sender, EventArgs e) 
{ 
    splitPanel1.Collapsed = !splitPanel1.Collapsed; 
}

EDIT 1

There is no easy way as you think. Have a look here and here to get an idea.

EDIT 2

You can add two toolStrips to both panels which are Dock:Top and add two buttons as in the below image which looks quite good. Just a thought...

enter image description here

Edit3

Splitter is another option for you. Have a look here.