如何激活鼠标左键单击 [英] how to active left mouse click

查看:91
本文介绍了如何激活鼠标左键单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有左右鼠标单击,例如,如果k == 1有效鼠标左键单击,如果k == 0有效鼠标右键单击

谢谢

i have active left and right mouse click for example if k==1 active left mouse click and if k==0 active right mouse click
thank you

推荐答案

如果你想检测它:

If you are trying to deteect it:
if (Mouse.Buttons == MouseButtons.Left)
    {
    ...
else if (Mouse.Buttons == MouseButtons.Right)
    {
    ...
    }



如果你正在尝试模拟按下鼠标按钮,然后你可以使用 Button.PerformClick [ ^ ],但没有直接的方法强制在.NET中右键单击 - 你可能不得不使用PInvoke发送鼠标消息到相关的控件ol。



更好的方法是从Click事件处理程序中提取代码并直接调用它......


If you are trying to simulate a mouse button press, then you can use Button.PerformClick[^], but there is no direct way to force a right click in .NET - you would probably have to use PInvoke to send a mouse message to teh relevant control.

A better way would be to extract the code from the Click event handler and call it directly...


这篇关于如何激活鼠标左键单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆