Here's the simplest way: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.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




Reply With Quote