1

我创建了一个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 = ??
4

1 回答 1

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
于 2013-11-01T14:01:59.303 回答