In Visual Studio.net when you move the mouse over a menu option the color changes. Does any body know how to change the color of a button when the mouse is rolled over a button?
Printable View
In Visual Studio.net when you move the mouse over a menu option the color changes. Does any body know how to change the color of a button when the mouse is rolled over a button?
Goto the code of the form that the button is on.
There are two combo boxes at the top of the code.
Select the button from the combo box on the right.
On the left select MouseEnter.
VB will produce a Sub that looks like this:
Private Sub Button1_MouseEnter(ByVal sender as Object, ByVal e as System.EventArgs) Handles Button1.MouseEnter
End Sub
The code in this sub will be fired when the mouse goes over the button, so enter the code so it looks like this:
Private Sub Button1_MouseEnter(ByVal sender as Object, ByVal e as System.EventArgs) Handles Button1.MouseEnter
Button1.BackColor = Color.Blue
End Sub
Then Repeat for MouseLeave
Private Sub Button1_MouseEnter(ByVal sender as Object, ByVal e as System.EventArgs) Handles Button1.MouseEnter
Button1.BackColor = SystemColor.Control
End Sub
I meant
Private Sub Button1_MouseLeave(ByVal sender as Object, ByVal e as System.EventArgs) Handles Button1.MouseLeave
Button1.BackColor = SystemColor.Control
End Sub