APIの名前 |
説明 |
---|---|
GetMouse |
カレントグラフポートのローカル座標が得られる |
LocalToGlobal |
ローカル座標をグローバル座標に変換する |
Private Type Point
y As Integer
x As Integer
End Type
Private Declare Sub GetMouse CDecl Lib "CarbonLib" (ByRef
aa As Point)
Private Declare Sub LocalToGlobal CDecl Lib "CarbonLib" (ByRef
aa As Point)
Private Sub UserForm_MouseMove(ByVal Button As Integer,
ByVal Shift As
Integer, ByVal x As Single, ByVal
y As Single)
Dim point1 As Point
Call GetMouse(point1)
Call
LocalToGlobal(point1)
x = point1.x - UserForm1.Left
y = point1.y - UserForm1.Top - 22
Label1.Caption = "x:" + Format(x)
Label2.Caption = "y:" + Format(y)
End Sub
で、結果はこんな感じ。