Hello
FYI - somehow the thread 36613 of this forum went above my head
Thanks
SamD
How is above statement in RED justified with below code as i am stuck and color does not change when the mouse is outside the border or edge of command buttonhttps://stackoverflow.com/questions/12200618/mousemove-what-is-the-reverse-event
Easier way: in your MouseMove event, test the X and Y arguments against the control's width and height (minus a margin, say 5) - if the mouse is in the margin, consider it a "Mouse out" and change the control's colours accordingly. No need for concurrent buttons, z-order manipulation, frames, etc.
Code:
Private Sub CommandButton1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal x As Single, ByVal y As Single)
CommandButton1.ForeColor = RGB(191, 191, 191)
CommandButton1.BackColor = RGB(31, 78, 120)
x = CommandButton1.Width - 5
y = CommandButton1.Height - 5
If x = x - 5 And y = y - 5 Then
CommandButton1.BackColor = vbWhite
CommandButton1.ForeColor = vbRed
End If
End Sub
Thanks
SamD
Last edited: