mouseover effect on command buttons
VB Code:
  1. Private Declare Function ReleaseCapture Lib "USER32" () As Long
  2. Private Declare Function SetCapture Lib "USER32" (ByVal hwnd As Long) As Long
  3.  
  4. Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  5. ' will change the background color for the command button
  6. With Command1
  7. If (X < 0) Or (Y < 0) Or (X > .Width) Or (Y > .Height) Then
  8. ReleaseCapture
  9. Command1.BackColor = &HE0E0E0
  10.  Else
  11. SetCapture .hwnd
  12. Command1.BackColor = vbWhite
  13. End If
  14. End With
  15. End Sub
  16.  
  17. Private Sub Command2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  18. ' will change the background color for the command button
  19. With Command2
  20. If (X < 0) Or (Y < 0) Or (X > .Width) Or (Y > .Height) Then
  21. ReleaseCapture
  22. Command2.BackColor = &HE0E0E0
  23.  Else
  24. SetCapture .hwnd
  25. Command2.BackColor = vbWhite
  26. End If
  27. End With
  28. End Sub