0

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

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”更改为较低的值出现。

4

0 回答 0