1,486
社区成员
发帖
与我相关
我的任务
分享
Option Explicit
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)
If Button = 0 Then
If (X < 0) Or (Y < 0) Or (X > Command1.Width) Or (Y > Command1.Height) Then
ReleaseCapture
' 放入鼠标离开的代码
Command1.Caption = "鼠标离开"
Else
SetCapture Command1.hWnd
' 放入鼠标进入的代码
Command1.Caption = "鼠标进入"
End If
End If
End Sub