7,763
社区成员
发帖
与我相关
我的任务
分享
Option Explicit
Private Type POINTAPI
x As Long
y As Long
End Type
Dim OldXY As POINTAPI
Dim NowXY As POINTAPI
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Sub Form_Load()
Dim lngP As Long
Timer1.Interval = 100
lngP = GetCursorPos(OldXY)
lngP = GetCursorPos(NowXY)
End Sub
Private Sub Timer1_Timer()
Dim lngP As Long
Dim strP As String
lngP = GetCursorPos(NowXY)
If OldXY.x - NowXY.x > 0 Then
strP = "向左平移;"
ElseIf OldXY.x - NowXY.x = 0 Then
Else
strP = "向右平移;"
End If
If OldXY.y - NowXY.y > 0 Then
strP = strP & "向上移动;"
ElseIf OldXY.y - NowXY.y = 0 Then
Else
strP = strP & "向下移动;"
End If
If strP <> "" Then Me.Caption = strP
lngP = GetCursorPos(OldXY)
End Sub