如何订阅双击? [英] How to subscribe to double clicks?

查看:183
本文介绍了如何订阅双击?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找到一种方式来订阅双击事件,谷歌搜索让我的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屋!

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