Reputation: 1505
I have two group boxes, the top one is collapsible. I want to adjust the layout of the lower group box when the upper group box collapses or expands.
Upvotes: 0
Views: 262
Reputation: 81620
A SplitContainer
can help in this type of display.
splitContainer1.Orientation = Orientation.Horizontal;
splitContainer1.IsSplitterFixed = true;
And then in each panel in the SplitContainer
control, you place your GroupBoxes
with both their Dock
settings set to Fill
.
When collapsing the top panel, you let the SplitContainer
handle it:
splitContainer1.Panel1Collapsed = !splitContainer1.Panel1Collapsed;
Upvotes: 0
Reputation: 16003
In addition to @Marco's suggestion, another option is the FlowLayoutPanel. It's useful when you want to ensure nearby controls adapt to fill the space when a control is resized.
Upvotes: 0