Hi, I've been strugglin' with this bit of code for too long now... I can't find what I'm doing wrong or missing here...
Everything else seems to work fine, but Line 16 makes no difference whatever alignment I code the text to be.
No matter what position I select, the result is always TopCenter.
Poppa.
Everything else seems to work fine, but Line 16 makes no difference whatever alignment I code the text to be.
No matter what position I select, the result is always TopCenter.
vb.net Code:
Private Sub New_Buttons() Dim x, y As Integer, c As Color, z As String x = 70 y = 495 c = Color.Blue z = "" For i = 1 To 9 Dim bt As New Button bt.Name = "Button" & i.ToString bt.AccessibleName = "bt(" & i.ToString & ")" bt.Text = z bt.Width = 40 bt.Height = 40 bt.BackColor = c bt.TextAlign = ContentAlignment.MiddleCenter bt.FlatAppearance.BorderSize = 0 bt.FlatStyle = FlatStyle.Flat bt.Location = New Point(x, y) Me.Controls.Add(bt) Select Case i 'Atributes for NEXT button Case 1 x = 110 c = Color.Green Case 2 y = 535 c = Color.Fuchsia Case 3 y = 575 c = Bgc Case 4 x = 70 y = 590 c = Bgc bt.Enabled = False Case 5 x = 30 y = 575 c = Bgc bt.Enabled = False Case 6 y = 535 c = Color.Red bt.Enabled = False Case 7 y = 495 c = Color.Yellow Case 8 x = 70 y = 535 c = Color.DarkOrange Case Else End Select AddHandler bt.Click, AddressOf ButtonClick Next End Sub
Poppa.