Monday, 12 August 2013

Can't dynamically fill third column TableLayoutPanel

Can't dynamically fill third column TableLayoutPanel

using vb 2012 i am dynamically creating a new table inside a table and
trying to fill 3 columns with labels, 1st and 2nd fill correctly but i
can't get filling of third working.
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)
Thanks for help!
EDIT:
Solved,
by changing Labels width to lower value from default "c" appeared.

No comments:

Post a Comment