如何订阅双击? [英] How to subscribe to double clicks?
问题描述
我试图找到一种方式来订阅双击事件,谷歌搜索让我的WinForms相关的东西,这是不是这样的,我不能使用。
I'm trying to find a way to subscribe to double-click event in XNA, and googling gets me winforms related stuff, which isn't the case, I can't use that.
使用时间跨度
和猜测的双击超时多久是在PC上也不是很可靠的。
Using Timespan
and guessing how long the timeout for double click is on a PC is not very reliable.
默认XNA输入系统也有这个小缺点:在游戏的高负荷的时刻,有时一个按键或鼠标点击获取更新的丢失,这会毁了双击可靠性
Default XNA input system also has this little flaw: sometimes a key press or a mouse click gets lost between updates and it would ruin double-click reliability in high load moments of the game.
我如何订阅双击.NET事件?
How do I subscribe to double-click events in .net?
不使用控制
类事件已被删除,因为实际上是使用类(请参阅我的答案)的方式。
The "without using Control
class events" was removed, since there actually is a way to use that class (see my answer).
推荐答案
我刚刚想出了这一点:
using wf = System.Windows.Forms;
wf.Form form = (wf.Form)wf.Control.FromHandle(this.Window.Handle);
form.MouseDoubleClick += new wf.MouseEventHandler(form_MouseDoubleClick);
所以,真的有办法使用为此在XNA 控制
类:)
这篇关于如何订阅双击?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!