C#右键单击按钮不会引发mouseclick事件 [英] C# Right mouse click on button does not raise mouseclick event
问题描述
我在表单上有一个按钮,想要处理左右单击。
I have a button on a form and want to handle both left and right clicks.
我正在处理MouseClick事件,但这仅在左侧引发单击。
I am handling the MouseClick event, but this is only raised on a left click.
这是我的代码中某个问题(我错过的设置)还是预期的功能?
Is this a problem somewhere in my code (a setting that I have missed) or the intended functionality?
如果无法解决此问题,最好的解决方法是-处理MouseUp事件?
If this is not possible to fix, what is the best workaround - to handle the MouseUp event?
我之所以要使用MouseClick是因为点击会被自动识别。
The reason I would like to use MouseClick is so that double clicks are automatically recognised.
感谢您的任何反馈。
推荐答案
显然,答案是 OnClick
不处理 Button
的右键单击事件。因此,解决方案是使用 MouseUp
/ MouseDown
并检查双击/单击鼠标中途打开/关闭的位置通过手动操作。
Apparently the answer to this is that OnClick
does not handle right click events for Button
s. The solution was therefore to use MouseUp
/MouseDown
and check for double clicks/clicks where the mouse moves on/off halfway through manually.
这篇关于C#右键单击按钮不会引发mouseclick事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!