VB该如何将鼠标彻底隐藏掉;

2024-12-05 06:30:13
推荐回答(2个)
回答1:

Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Declare Function ClipCursor Lib "user32" (lpRect As Any) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type

Private Sub Command1_Click()
Dim rt As RECT
GetWindowRect Me.hwnd, rt
ClipCursor rt
ShowCursor 0
Sleep 5000
ShowCursor 1
ClipCursor 0
End Sub

释放后鼠标随便点下就可以解除锁定了

回答2:

,或者失交事件与点击事件合用,可以达到目的。
2、在窗体2的resize事件等设置top=form1.top+m:left=form1.left+n
在窗体1的resize等事件里同样设置。
实质上我知道,你用窗体2代替了窗体1上的一个可以显示可以隐蔽的部分!不过你要用一个框架,效果会更好,这个问题就不存在了!