设定Mouse在某个固定范围

设定Mouse在某个固定范围,第1张

设定Mouse在某个固定范围,第2张

键入RECT
左等长
上等长
右等长
下等长
结束类型

声明函数clip cursor Lib " user 32 "(lpRect As Any)Long
声明函数show cursor Lib " user 32 "(ByVal bShow As Long)
声明函数SetCursorPos Lib " user 32 "(ByVal x As Long,_
ByVal y As Long)
声明函数getwindow rect Lib " user 32 " Alias " getwindow rect " _
(ByVal hwnd As Long,lpRect As RECT) As Long

注意:将鼠标的可移动范围设置在一个控件项内
public function to lockcursor(byvalctlhwnd as long)as boolean
dimrect5 are CT
dimres as long
GetWindowRect ctlHwnd,对rect 5进行注释:获取窗口的四个角
rect 5 . top = rect 5 . top
rect 5 . left = rect 5 . left
rect 5 . bottomSetCursorPos (rect5。Top + rect5。Bottom) 2,(rect5。左+右5。右)2

RES = clip cursor(rect 5)
如果res = 1,则
toLockCursor = True
Else
toLockCursor = False
End If
End函数

注意:将鼠标移动的圆圈设置为screen
public sub touch cursor()
dim r screen as rect
r screen . top = 0
r screen . left = 0
r screen。右=屏幕。宽屏。TwipsPerPixelX
rscreen。底部=屏幕。高度屏幕。TwipsPerPixelY
clip cursor r screen
End Sub

例如,设置鼠标只能在形式为
private子命令1 . click()
call to lockcursor(me . hwnd)
end sub
private子命令2 . click()
call to unlockecursor()[/br

位律师回复
DABAN RP主题是一个优秀的主题,极致后台体验,无插件,集成会员系统
白度搜_经验知识百科全书 » 设定Mouse在某个固定范围

0条评论

发表评论

提供最优质的资源集合

立即查看 了解详情