It would have helped if you showed the code you have to handle a double click on the label.
If you have many labels and you want to be able to change the backgound colour of each one by double clicking on it, then use a single double click event handler for all the labels. It might look like this (note that in the event handler, sender is an object variable that refers to the control that was double clicked):
Sub Label_DoubleClick(sender As Object, e As EventArgs) Handles Label1.DoubleClick, Label2.DoubleClick, _
Label3.DoubleClick, Label1.DoubleClick 'etc.
Dim myColour As Color
' Your code that selects a colour and assignes it to myColour goes here
Dim myLabel As Label = CType(sender, Label)
mylabel.BackColor = myColour
End Sub
No comments:
Post a Comment