tableLayoutPanel列宽

时间:2013-10-03 06:06:29

标签: .net winforms ironpython tablelayoutpanel

我创建了一个TableLayoutPanel,我想减少其中一列的宽度。 TableLayoutPanel.ColumnStyles是否可行?我发现MSDN文档令人困惑。如何应用tableLayoutPanel.ColumnStyle?

self.tableLayoutPanel.Location = Point(20,80)
self.tableLayoutPanel.Size = Size(200,50)
self.tableLayoutPanel.RowCount = 2
self.tableLayoutPanel.ColumnCount = 6
self.tableLayoutPanel.AutoSize = True
self.tableLayoutPanel.AutoScroll = False
self.tableLayoutPanel.CellBorderStyle = TableLayoutPanelCellBorderStyle.Outset
#self.tableLayoutPanel.ColumnStyles = ??

1 个答案:

答案 0 :(得分:3)

您需要将列样式和行样式添加到每个列和行:

示例:

For i As Integer = 0 To self.tableLayoutPanel.ColumnCount - 1
  self.tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 64))
Next
For i As Integer = 0 To self.tableLayoutPanel.RowCount - 1
  self.tableLayoutPanel.RowStyles.Add(New RowStyle(SizeType.Absolute, 24))
Next