M
Majed Abbas
Guest
Hi
I have three labels and one button. I want to randomize the background color for label1 and label2, on the condition that not come the same color in label1 and label2, and with the click of a button I want to get label3 background color, which is a mixed color between label1 color and label2 color
my code is:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
' Create a List
Dim colorList As New List(Of SolidBrush
Dim rnd = New Random()
' Get a random item from the list between 0 and list count
Dim randomColour = colorList(rnd.Next(0, colorList.Count))
Dim randomColour1 = colorList(rnd.Next(0, colorList.Count))
' Assign the color to the label
Label1.BackColor = randomColour.Color
Label2.BackColor = randomColour1.Color
Label3.BackColor = (Color.FromArgb(Label1.BackColor.ToArgb + Label2.BackColor.ToArgb))
End Sub
but it is not work
Continue reading...
I have three labels and one button. I want to randomize the background color for label1 and label2, on the condition that not come the same color in label1 and label2, and with the click of a button I want to get label3 background color, which is a mixed color between label1 color and label2 color
my code is:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
' Create a List
Dim colorList As New List(Of SolidBrush
Dim rnd = New Random()
' Get a random item from the list between 0 and list count
Dim randomColour = colorList(rnd.Next(0, colorList.Count))
Dim randomColour1 = colorList(rnd.Next(0, colorList.Count))
' Assign the color to the label
Label1.BackColor = randomColour.Color
Label2.BackColor = randomColour1.Color
Label3.BackColor = (Color.FromArgb(Label1.BackColor.ToArgb + Label2.BackColor.ToArgb))
End Sub
but it is not work
Continue reading...