Reputation: 1110
I am having a group box of width 900px and height 250px. and have to place 20 around radio buttons in it in a 4 rows * 5 columns tabular format. But at present its coming in 20 rows * 1 column format. And i have to do this using groupbox. I'll be glad for the answers thank you .
Upvotes: 1
Views: 1471
Reputation: 184
Unfortunately, this is not imporssible, as Group control does not support overflow style child management. You have two options (maybe more):
for the TableLayoutPanel option, you might try below snippet to see if it matches your requriment:
TableLayoutPanel Table = new TableLayoutPanel();
Table.AutoSize = true;
Table.RowCount = 4;
Table.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
Table.GrowStyle = System.Windows.Forms.TableLayoutPanelGrowStyle.AddCols;
this.Controls.Add(Table);
for the listbox, you can try this RadioListBox, and also set:
listBox1.MultiColumn = true;
And also you need adjust the listbox height so that exactly 4 rows are there.
If WPF is an option, this will be trivial as you can do this with XAML, and implementation your own ItemTemplate is just a breeze.
Upvotes: 1