调用api
创新互联公司专业为企业提供卢龙网站建设、卢龙做网站、卢龙网站设计、卢龙网站制作等企业网站建设、网页设计与制作、卢龙企业网站模板建站服务,十多年卢龙做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。
在Visual Baisc点虐 中的声明:
Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Public Const MOUSEEVENTF_LEFTDOWN = H2 '模拟鼠标左键按下
Public Const MOUSEEVENTF_LEFTUP = H4 ’模拟鼠标左键释放
Public Const MOUSEEVENTF_MIDDLEDOWN = H20 '模拟鼠标中间键按下
Public Const MOUSEEVENTF_MIDDLEUP = H40 '模拟鼠标中间键释放
Public Const MOUSEEVENTF_RIGHTDOWN = H8 '模拟鼠标右键按下
Public Const MOUSEEVENTF_RIGHTUP = H10 '模拟鼠标右键释放
Public Const MOUSEEVENTF_MOVE = H1 '模拟鼠标指针移动
例:
mouse_event MOUSEEVENTF_LEFTDOWN,10,10,0,0
'在(10,10)模拟鼠标左键按下
你是想使用右键菜单吧?
例如给picturebox添加右键菜单可以这样:
从工具箱拖一个ContextMenuStrip到窗体上,然后自己添加你喜欢的菜单项,然后把PictureBox的ContextMenuStrip属性设置为你你刚添加的哪个ContextMenuStrip,下拉列表里会有你刚刚添加的控件的!
调用api
在Visual Baisc点虐 中的声明:
Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Public Const MOUSEEVENTF_LEFTDOWN = H2 '模拟鼠标左键按下
Public Const MOUSEEVENTF_LEFTUP = H4 ’模拟鼠标左键释放
Public Const MOUSEEVENTF_MIDDLEDOWN = H20 '模拟鼠标中间键按下
Public Const MOUSEEVENTF_MIDDLEUP = H40 '模拟鼠标中间键释放
Public Const MOUSEEVENTF_RIGHTDOWN = H8 '模拟鼠标右键按下
Public Const MOUSEEVENTF_RIGHTUP = H10 '模拟鼠标右键释放
Public Const MOUSEEVENTF_MOVE = H1 '模拟鼠标指针移动
例:
mouse_event MOUSEEVENTF_LEFTDOWN,10,10,0,0
'在(10,10)模拟鼠标左键按下
你已经有了“鼠标右键点击的事件”
说明你肯定已经有了if e.button=windows.forms.mousebuttons.right then
你只需要找到这条语句,通常这句话应该在你的mouseclick事件中。
这条语句改成
if e.button=windows.forms.mousebuttons.left or e.button=windows.forms.mousebuttons.right then
就可以了!
^_^