C# Winforms: GroupBox not resizing
c#-4.0, groupbox, winforms
Solution
A tableLayoutPanel can help with this.
- Add a tableLayoutPanel and size it to fit your needs.
- Anchor the table to Top, Bottom, Left, and Right
- Put GroupBoxA into the upper left cell of the table
- Put GroupBoxB into the lower right cell of the table
- For both GroupBox size them accordingly and anchor them to all 4 sides.
- Now they will grow and shrink proportionately with the app.
Additionally you can add more of your controls to the table. If you need a control to span multiple rows or columns use the RowSpan/ColumnSpan property.
Problem
I have two `GroupBoxes` on the left side of one of my `TabControls`, call them GroupBox A (top left), and GroupBox B (bottom left). The GroupBoxes do not resize like I would hope. Example: When I resize the main form that has the TabControls with my mouse, or maximize it, or move it to a screen with lower resolution, GroupBox B keeps its width / height. This causes GroupBox B to draw over GroupBox A, kind of like a 'always on top' effect. Desired: Would like both GroupBoxes to resize according to one another / proporitionally and fit the area they are given. Ideas?