I have GroupBox that is populated by Button controls, and a combobox that populates the groupBox based on the selected number in combobox(8, 16, 32).
This is my populateGroupbox method
private void populateGroupbox (GroupBox gBox, int number )
{
for (int i = 0; i < number; i++)
{
Button btn = new Button();
btn.Location = new Point(16, 30 + i*30);
btn.Text = (i + 1).ToString();
btn.Width = 40;
gBox.Controls.Add(btn);
Application.DoEvents();
}
}
Based on the number param in that method it adds that many buttons.
Now here is my problem, if i select 16 or 32 controls kinda spill out of borders of groupBox, i need to find out a way so that if i select more that 8, controls(button) will display in 2 rows of 8 controls, i don't know how to do that.
Any tips?
How can i use flowpanelLayout in this?