0
votes

I have a groupbox with 3 columns, how would i allow users to resize the column size?

Inside each groupbox column is another groupbox with a textbox set to fill the area. When the user maximizes the form I want the groupbox columns to be able to be resized by the user.

Edit... This is a winforms application

Edit again.... I have now inspected it alittle closer and whats actually going on is I have a main groupbox with a TableLayoutPanel with 3 columns with a group box inside each column. (Sorry this is a really old project that im bringing to life.

1
Since when does a GroupBox have columns?Abbas
In the properties for the groupbox you can set the columnCount aswel as the row countErnie
Why don't you use a TableLayoutPanel to achieve this?Fabian Bigler
@user3298624 Check GroupBox WinForms or GroupBox WPF, also I opened Visual Studio and added a GroupBox to a form, no property ColumnCount.Abbas
Just tried the TableLayoutPanel control and am faced with the same problem, when i run the app im still not able to expand the the qroupboxes in the columnsErnie

1 Answers

6
votes

You could use a SplitContainer control. It gives you two panels in which to place other controls, including more SplitContainers.

So if you drop one on your form, then drop a second one inside one of the panels on the first, you'll have three "columns" where you can place each of your GroupBoxes.

enter image description here

Then you could set IsSplitterFixed = true on the splitters initially, to disable resizing the panels, then re-enable them if the user maximizes the window:

private void Form1_SizeChanged(object sender, EventArgs e)
{
    splitContainer1.IsSplitterFixed = WindowState != FormWindowState.Maximized;
    splitContainer2.IsSplitterFixed = WindowState != FormWindowState.Maximized;
}