Question

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.

Was it helpful?

Solution

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;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top