无法动态填充第三列TableLayoutPanel

时间:2013-08-12 23:45:10

标签: vb.net tablelayoutpanel

使用vb 2012我在表格中动态创建一个新表格并尝试用标签填充3列,正确填充第1和第2列,但我无法填写第三个工作。

Dim ctr As New TableLayoutPanel
ctr.BackgroundImage = Serials_Downloader.My.Resources.Resources.serialbg
ctr.Visible = True
ctr.BackColor = Color.Transparent
ctr.ColumnCount = 3
ctr.Width = 212
ctr.Height = 64

TableLayoutPanel1.Controls.Add(ctr, 0, TableLayoutPanel1.RowCount - 1)



Dim lblNew2 As New Label()
lblNew2.Text = "a"
lblNew2.ForeColor = System.Drawing.Color.White
lblNew2.Visible = True
lblNew2.TextAlign = ContentAlignment.MiddleCenter
lblNew2.Font = New Font("Decker", 8)
lblNew2.Dock = DockStyle.Fill
ctr.Controls.Add(lblNew2, 0, 0)

Dim lblNew As New Label()
lblNew.Text = "b"
lblNew.ForeColor = System.Drawing.Color.White
lblNew.Visible = True
lblNew.TextAlign = ContentAlignment.MiddleCenter
lblNew.Font = New Font("Decker", 8)
lblNew.Dock = DockStyle.Fill
ctr.Controls.Add(lblNew, 1, 0)

Dim lblNew3 As New Label()
lblNew3.Text = "c"
lblNew3.ForeColor = System.Drawing.Color.White
lblNew3.Visible = True
lblNew3.TextAlign = ContentAlignment.MiddleCenter
lblNew3.Font = New Font("Decker", 8)
lblNew3.Dock = DockStyle.Fill
ctr.Controls.Add(lblNew3, 2, 0)

感谢您的帮助!

编辑:

解决,

通过将标签宽度更改为默认值“c”的较低值出现。

0 个答案:

没有答案