how to restore backcolor of command button
hi friends
initially backcolor of command button has one particular color ( say RED), when mouse moves over it the backcolor of command button should be changed to some another color (say GREEN) and original color (i.e RED) should be restore back when mouse moves out of the command button.please help me. thank you.
Re: how to restore backcolor of command button
Here's the simplest way:
Code:
Option Explicit
Private Const ON_MOUSE_IN As Long = vbGreen
Private Const ON_MOUSE_OUT As Long = vbRed
Private Sub Form_Load()
Command1.BackColor = ON_MOUSE_OUT
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Command1.BackColor <> ON_MOUSE_OUT Then Command1.BackColor = ON_MOUSE_OUT
End Sub
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Command1.BackColor <> ON_MOUSE_IN Then Command1.BackColor = ON_MOUSE_IN
End Sub
Also - don't forget to set your CMD's .Style Property to 1 - Graphical. Since it's a read only Property you can't do it in run-time. So, do it in design time.
Re: how to restore backcolor of command button