Poppa Mintin
Well-known member
- Joined
- Jan 4, 2018
- Messages
- 45
- Programming Experience
- 10+
Hi,
Here is code for generating a number of buttons on myForm1.
For the purposes of this question suffice to say everything works just fine, I can generate anything from 25 to 150 buttons as selected by the user. So I have no need to explain all the variables, they're irrelevant.
Here's the problem:
No matter what colour I select for the ForeColor of these buttons I always get a sort of dirty blue to dirty grey text.
Changing the form's BackColor has no effect from Color.White or (say) Color.Yellow, makes no difference.
Even a Color.White ForeColor on a Color.White BackColor the text is grey.
What's going on ?
Here is code for generating a number of buttons on myForm1.
VB.NET:
Private Sub Buts()
Dim num As Int32 = 0
Dim fnt As New System.Drawing.Font("Comic Sans MS", CInt(gap * 0.38))
For i = 1 To col
For j = 1 To row
num += 1
Dim butn As New Button
With butn
.BackgroundImageLayout = ImageLayout.None
.FlatStyle = FlatStyle.Flat
.FlatAppearance.BorderSize = 0
.Enabled = False
.Name = "Button" & num.ToString
.Height = box + qrt
.Width = box + qrt
.Location = spot(num)
.BackColor = Me.BackColor
.ForeColor = Color.Red
.Font = fnt
.Text = initial
End With
Me.Controls.Add(butn)
Next
Next
End Sub
Here's the problem:
VB.NET:
.ForeColor = Color.Red
Changing the form's BackColor has no effect from Color.White or (say) Color.Yellow, makes no difference.
Even a Color.White ForeColor on a Color.White BackColor the text is grey.
What's going on ?