Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Collapsing and Expanding SplitContainer panels

I have 3 split containers in my winform application. splitContainer1, splitContainer2, splitContainer3

splitContainer1 is the main split container. in it's panel1 I put splitContainer2 and in its panel2 I have splitContainer3

I then added two buttons to collapse/hide splitContainer3 panels: whenever I click on a button, it gets collapsed, but when I want 2 panels be collapsed, one of them automatically gets expanded again What can be the problem?

private void btToggleCI_Click(object sender, EventArgs e)
{
    switch (splitContainer3.Panel1Collapsed)
    {
        case false:

            splitContainer3.Panel1Collapsed = true;
            btToggleCI.ForeColor = Color.Gray;

            break;

        case true:

            splitContainer3.Panel1Collapsed = false;
            btToggleCI.ForeColor = Color.Black;

            break;
    }
}

private void btToggleTestPlan_Click(object sender, EventArgs e)
{
    switch (splitContainer3.Panel2Collapsed)
    {
        case false:

            splitContainer3.Panel2Collapsed = true;
            btToggleTestPlan.ForeColor = Color.Gray;

            break;

        case true:

            splitContainer3.Panel2Collapsed = false;
            btToggleTestPlan.ForeColor = Color.Black;

            break;
    }
}
like image 233
Saeid Yazdani Avatar asked Dec 08 '11 14:12

Saeid Yazdani


1 Answers

A SplitContainerControl can have up to one panel collapsed.

You can't collapse both panels simultaneously (what would that look like?).

like image 78
SLaks Avatar answered Sep 30 '22 08:09

SLaks