Reputation: 567
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.
Upvotes: 0
Views: 2008
Reputation: 66449
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.
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;
}
Upvotes: 6