如何检测,如果Control.Click事件是由鼠标,键盘,还是其他什么东西? [英] How to detect if the Control.Click event was by the mouse, keyboard, or something else?
本文介绍了如何检测,如果Control.Click事件是由鼠标,键盘,还是其他什么东西?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何判断一个 Control.Click
事件是由鼠标或键盘触发?
How can I tell if a Control.Click
event was triggered by the mouse or by the keyboard?
处理鼠标点击
和键preSS
简化版,为我工作,因为那样的话我怎么会知道如果别的东西触发了点击? (例如 PerformClick
)
Handling MouseClick
and KeyPress
does't work for me, because then how would I know if something else triggered the click? (e.g. PerformClick
)
推荐答案
您不能。使用 Control.MouseClick 事件在 Control.Key preSS 事件,所以你可以告诉事件的源头。请记住,对重点和按Ctrl +键控制的空间可以生成点击一个按钮为好。
You can't. Use the Control.MouseClick event and the Control.KeyPress event so you can tell the source of the event. And remember that a space on the control with focus and a Ctrl+ key can generate a click on a button as well.
这篇关于如何检测,如果Control.Click事件是由鼠标,键盘,还是其他什么东西?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文