I am drawing a group box at run time with dock top, and inside it I am drawing buttons of fix height and width Autosize property of group box is true. The buttons I am drawing are of less height than the default height of the group box which is acquiring at run time. How can I remove that extra lower bottom space for the group box?
GroupBox gbFreeCust = new GroupBox()
{
Dock= DockStyle.Top,
Text = item.CatName,
AutoSize = true,
AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowOnly
};
pnlFreeCust.Controls.Add(gbFreeCust);
groupbox.height = max(button1.height,button2.height)+ margin
? – OlivierH