Tag: margin

以编程方式将边距和/或填充分配给标签

在试图让TableLayoutPanel中的一些标签从它们的单元格的左上角移动到单元格的中心时,我试图尝试添加填充和/或边距。 但是,我没有尝试过任何工作。 这是我尝试过的代码和结果: // Setting the padding just cuts off the bottom part of the text //lbl.Padding = new System.Windows.Forms.Padding(1); // How to set Margin? //lbl.Margin = new System.Windows.Forms.Margin(1); <- This mimics "Padding" but is not recognized //lbl.Margin = new Thickness(6); <- This is the only example I could find, but it's for WPF