📄 7426.html
字号:
<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:nospam@nospam.com">David Wong</a> on November 17, 1998 at 22:26:33:<p>
In Reply to: <a href="7341.html">Re: Re; Splash Window</a> posted by Honey on November 14, 1998 at 12:57:43:<p>
的确是十分好的方法!!!但请问 ClientToScreen 有什么用,在这里似乎没有用到哦 ...<p>: 可以使用API使滑鼠游标局限于表单中<br>: 宣告方式如下<br>: Private Declare Function ClientToScreen Lib "user32" (ByVal hWnd As Long, lpPoint As POINTAPI) As Long<br>: Private Declare Function ClipCursor Lib "user32" (lpRect As RECT) As Long<br>: 若于模组中使用 得去掉Private<p>: 另外还得宣告一些型态<br>: Private Type POINTAPI<br>: X As Long<br>: Y As Long<br>: End Type<p>: Private Type RECT<br>: Left As Long<br>: Top As Long<br>: Right As Long<br>: Bottom As Long<br>: End Type<br>: 若于模组中使用 也得去掉Private<p>: 之后提供你一个SUB<br>: Public Sub ClipTo(ToCtl As Object)<p>: On Error Resume Next<p>: Dim tmpRect As RECT<br>: Dim pt As POINTAPI<p>: With ToCtl<p>: If TypeOf ToCtl Is Form Then<br>: tmpRect.Left = (.Left \ Screen.TwipsPerPixelX)<br>: tmpRect.Top = (.Top \ Screen.TwipsPerPixelY)<br>: tmpRect.Right = (.Left + .Width) \ Screen.TwipsPerPixelX<br>: tmpRect.Bottom = (.Top + .Height) \ Screen.TwipsPerPixelY<br>: ElseIf TypeOf ToCtl Is Screen Then<br>: tmpRect.Left = 0<br>: tmpRect.Top = 0<br>: tmpRect.Right = (.Width \ Screen.TwipsPerPixelX)<br>: tmpRect.Bottom = (.Height \ Screen.TwipsPerPixelY)<br>: Else<br>: pt.X = 0<br>: pt.Y = 0<br>: Call ClientToScreen(.hWnd, pt)<br>: tmpRect.Left = pt.X<br>: tmpRect.Top = pt.Y<br>: pt.X = .Width<br>: pt.Y = .Height<br>: Call ClientToScreen(.hWnd, pt)<br>: tmpRect.Bottom = pt.Y<br>: tmpRect.Right = pt.X<br>: End If<br>: <br>: Call ClipCursor(tmpRect)<p>: End With<p>: End Sub<p>: 之后 只要在FORM_LOAD() 中加入以下程式码<br>: ClipTo Me<br>: Me.Moveable = False<br>: 就可以限制滑鼠游标<br>: 另外 可别忘了在Form_Unload( ...)中加入<br>: ClipTo Screen<br>: 否则 程式结束时 滑鼠还是会局限在那个范围喔<p>: 另外 如果表单移动过后 滑鼠便不受局限<br>: 所以我用Me.Moveable = False<br>: 使得表单不能移动<br>: 若你想让表单可移动 可去掉Me.Moveable = False<br>: 另外在Form_MouseMove()<br>: 加入ClipTo Me<br>: 若你不想将程序放入message window<br>: 也可以稍作修改 将Me改成message window的NAME<p>
<br>
<br><hr size=7 width=75%><p>
<a name="followups">Follow Ups:</a><br>
<ul><!--insert: 7426-->
</ul><!--end: 7426-->
<br><hr size=7 width=75%><p>
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -