19310.html
来自「VB技巧问答10000例,是一个教程」· HTML 代码 · 共 23 行
HTML
23 行
<html> <head> <title>Re: 请问前辈,滑鼠移动时会触发何事件,如何拦截?</title> </head> <body bgcolor="#FFFFFF" vlink="#808080"> <center> <h1>Re: 请问前辈,滑鼠移动时会触发何事件,如何拦截?</h1> </center><hr size=7 width=75%><hr size=7 width=75%><p>Posted by <a href="mailto:harlem73@ms26.hinet.net">哈林</a> on September 25, 1999 at 23:48:55:<p>In Reply to: <a href="19160.html">请问前辈,滑鼠移动时会触发何事件,如何拦截?</a> posted by Jake on September 20, 1999 at 10:08:50:<p>也是得呼叫API哩...<br>请加入一个Timer和一个Label<br>并新增一个模组<br>以下的程式码请参考:<p>在模组:<br>Public Declare Function GetCursorPos Lib "user32" (lpPoint As PointAPI) As Long<br>Public Declare Function ScreenToClient Lib "user32" (ByVal hwnd As Long, lpPoint As PointAPI) As Long<br>Type PointAPI<br> x As Long<br> y As Long<br>End Type<p>在一般:<br>Dim MousePos As PointAPI<p>Private Sub Timer1_Timer()<br>Dim Rval As Long<br>Rval = GetCursorPos(MousePos) '捉取绝对座标值<br>Rval = ScreenToClient(hwnd, MousePos) '转换成控制项或物件上的相对座标值<br>Label1.Caption = MousePos.x & "," & MousePos.y<br>End Sub<p>'Label1.Caption里的值就是你要的东西了~<p><p><br><br><hr size=7 width=75%><p><a name="followups">Follow Ups:</a><br><ul><!--insert: 19310--></ul><!--end: 19310--><br><hr size=7 width=75%><p></body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?