What could cause a Label control to not grow/shrink to its containing cell inside of a TableLayoutPanel? I have a few TableLayoutPanels inside another encompassing TableLayoutPanel. I need the Label controls within the cells to adjust their size when the form is resized. Button controls do this but Label controls do not.
I tried a simple experiment with Label controls in a more simpler example that uses just one TableLayoutPanel and it works; the Label controls resize fine when I set the Dock property to “fill,” but I can’t get it working in the form that has multiple TableLayoutPanel controls embedded within another one.
Microsoft suggests one should avoid nesting here:
http://msdn.microsoft.com/en-us/library/ms171689.aspx
However, I need to be able to make separate groups of controls within a TableLayoutPanel. Can anyone provide some insight?
Have you set the
Label.AutoSizeproperty of your labels tofalse? Per MSDN’s documentation on theAutoSizeproperty (emphasis mine):