Collapse and expand SplitContainer panels

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

splitContainer1 is the main separation container. in it panel1 i put splitContainer2 and in its panel2 i have splitContainer3

Then I added two buttons to minimize / hide the splitContainer3 panels: whenever I click on the button, it crashes, but when I want the two panels to be minimized, one of them automatically gets expanded again . maybe a 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; } } 
+4
source share
1 answer

SplitContainerControl can have ruins of up to one panel.

You cannot collapse both panels at the same time (what would it look like?).

+7
source

Source: https://habr.com/ru/post/1385346/


All Articles