怎么获得鼠标的当前位置?

猫工 2003-10-16 10:13:41
是用 GetCursorPos 吗?我不知道它怎么用啊!
...全文
37 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
kmzs 2003-10-19
  • 打赏
  • 举报
回复
支持
flc 2003-10-19
  • 打赏
  • 举报
回复
学习
itlive 2003-10-18
  • 打赏
  • 举报
回复
dim r,c as string
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
r = X
c = Y
End Sub
'I don't think I can help you with this programe
danpianji2002 2003-10-17
  • 打赏
  • 举报
回复
配合有关api的书看一下啊也不用特意学的
现用先看就行啦
monday48427 2003-10-17
  • 打赏
  • 举报
回复
用个简单的方法:
Dim c, d As Single
c = X & ""
d = Y & ""
hhh21345679 2003-10-17
  • 打赏
  • 举报
回复
声明部分为:Public Declare Function GetCursorPos Lib "user32"Alias "GetCursorPos" (lpPoint As POINTAPI) As Long
您直接引用就行了!
Jackile 2003-10-17
  • 打赏
  • 举报
回复
不用你写的,通过API浏览器,可以复制过来,你只要用就可以了!
yjch 2003-10-17
  • 打赏
  • 举报
回复
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Text1.Text = X
Text2.Text = Y
End Sub
'I don't think I can help you with this programe !!
猫工 2003-10-17
  • 打赏
  • 举报
回复
我知道是这个函数,可是代码我不会写
whjwsy 2003-10-17
  • 打赏
  • 举报
回复
mousemove、mousedown 、mouseup都可以得到鼠标的当前位置,就是有一点要注意,在不同控件上坐标是不同的.
danpianji2002 2003-10-16
  • 打赏
  • 举报
回复
API函数需要声明的Public Declare Function GetCursorPos Lib "user32"Alias "GetCursorPos" (lpPoint As POINTAPI) As Long
给你推荐一个很好的API浏览器
好像是在WWW.PFANS.NET
easydone 2003-10-16
  • 打赏
  • 举报
回复
没错,得到用GetCursorPos,设置用SetCursorPos
tanta 2003-10-16
  • 打赏
  • 举报
回复
将下面的代码加入你的程序中,你就可以使用GetCursorPos函数了
Public Declare Function GetCursorPos Lib "user32" Alias "GetCursorPos" (lpPoint As POINTAPI) As Long
Public Type POINTAPI
x As Long
y As Long
End Type

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧