Groupbox with a flowlayout panel inside and autosize = true shrinks like it is empty

scott picture scott · Jul 27, 2010 · Viewed 16.7k times · Source

I have a groupbox that holds a flowlayout panel and the flowlayout panel holds a bunch of controls. I set the flowlayout panel to dock with the parent. Since I don't know how many controls will be in the panel, I set the group box autosize to true and autosizemode to grow and shrink. When I do this the groupbox shrinks as if it is empty. I need the caption so I can't remove the groupbox. Anyone know why this is happening?

Answer

Hans Passant picture Hans Passant · Jul 27, 2010

There's nothing that stops the FlowLayoutPanel from shrinking to nothing. You'll at least have to set its AutoSize property to True as well.