在 WPF 应用程序中禁用右键单击(按住). [英] Disable a right click (press and hold) in WPF application.

查看:67
本文介绍了在 WPF 应用程序中禁用右键单击(按住).的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发在 Windows XP Standard 上运行的触摸屏应用程序.使用当前的硬件来调用右键单击用户必须单击并按住几秒钟,但这可能会干扰其他操作,例如在滚动查看器中按住重复按钮,因此我决定禁用右键单击.

I am working on the touch screen application which is running on Windows XP Standard. With current hardware to invoke a right click user has to click and hold for couple of seconds, but this might interfere with other actions like holding a repeat button in the scrollviewer, so I have decide to disable a right click.

理想情况下,我不想禁用应用程序级别的右键单击,但如果不可能,禁用 Windows 级别的右键单击也适用于我.

I would ideally wan't to disable a right click on the application level, but if it is not possible, disable right click on windows level would also work for me.

推荐答案

您可以覆盖 Window 上的 OnPreviewMouseRightButtonDown 并将 Handled 设置为 true.您还需要处理 OnPreviewMouseRightButtonUp(感谢 Vitalij 指出这一点)

You can override the OnPreviewMouseRightButtonDown on the Window and set Handled to true. You also need to handle OnPreviewMouseRightButtonUp (thanks to Vitalij for pointing this out)

这应该可以解决问题.

这篇关于在 WPF 应用程序中禁用右键单击(按住).的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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