TableLayoutPanel Last Row Size Too Big

Using the dock property solves the last row height problem, but creates another by changing the table width to match the container width (100%). I wanted the height in the last row to be correct but I do not want the forced 100% width.

Instead of using the Dock property, I used:

AutoSizeMode = AutoSizeMode.GrowAndShrink

That made the autosize work correctly on the last row and column.


Based on your design and your requirements I suggest you to make Dock property of TableLayoutPanel to top.


I just had very similar problem. Filling TableLayoutPanel programatically (with autoscroll) and the last row was too high. Dock work-around was not suitable for me.

Fixed by adding empty Label as the last row. It "occupies" the last row, but is not visible. Enough for me.