There\'s some spacing between the Buttons I add to my TableLayoutPanel
. I removed the border in the Button and set the Margin and Padding to 0 in the Panel. But I c
To remove the space between buttons in cells, it's enough to set dock property of them to fill and then remove default margins of buttons:
var b = new Button();
b.Dock = DockStyle.Fill;
b.Margin = new Padding(0);
Note:
Usually it's better to set Dock
property of controls which you host in cells to Fill
. This way your controls will follow TableLayouPanel sizing rules which you set for columns and rows.
TableLayoutPanel use Margin
property of control to set the location of control in cell. So If you don'n want to set Dock
and you prefer to set the Size
manually, it's enough to set the Margin
only.