I'm trying to dynamically add groupboxes that have been dynamically sized based on the controls inside them (labels, textboxes, dropdowns, check, etc). I would also like it all to intelligently resize on a maximize or resizing command of the parent panel/form....
Honestly I'm a little miffed that the infragistics group box and many of the infragistics controls don't have the autosize property...???
Have you recieved an answer for this yet?? If you did can you share. I'm trying to do something similar to this too and short from calculating the size of the content and setting the group box size to the calculated size I can't find a way to have the group box auto size. I've gotten the group box to size on the first load but if the window size changes the group boxes do not reflect the change in size.
No, I don't think I ever got a good answer.
This is what I ended up coding:
...
var sectionPanel = _sectionPanels[i] = new TableLayoutPanel();
_pnlMainContent.ClientArea.Controls.Add(sectionPanel);
sectionPanel.Dock = DockStyle.Fill;
sectionPanel.GrowStyle = TableLayoutPanelGrowStyle.AddRows;
sectionPanel.AutoScroll = true;
//GROUPS
for (int j = 0; j < sectionChild.NoteDictionaryGroups.Count; j++)
{
int rowCount = groupChild.NoteDictionaryQuestions.Count;
var groupBox = new UltraGroupBox();
groupBox.Dock = DockStyle.Fill;
sectionPanel.Controls.Add(groupBox);
groupBox.Height = 20 + rowCount * 24;
//MAGIC NUMBERS: INSTEAD OF AUTOSIZE SINCE INFRAGISTICS GROUP BOXES DON'T IMPLEMENT THEM! AND YES I AM YELLING
notice the silly comment. I think I had resentment at the time over this issue.
So anyway, yeah, it's a table layout panel, and I just size the group boxes by this rowcount thing so that their minimum size would be at least big enough for single rows for each control. Although in this example the group boxes will/can grow to fit the panel.