Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim MouseOver As Boolean
'判断当前鼠标位置是否在Object1上
MouseOver = (0 <= X) And (X <= Command1.Width) And (0 <= Y) And (Y <= Command1.Height)
If MouseOver Then
Me.BackColor = RGB(255, 0, 0)
SetCapture Command1.hwnd
Else
Me.BackColor = RGB(0, 255, 0)
ReleaseCapture
End If
End Sub
vb6实现鼠标移出效果
最新推荐文章于 2024-10-18 09:26:26 发布