如何停止在表格上的鼠标单击 [英] How to stop mouse click on a form

查看:57
本文介绍了如何停止在表格上的鼠标单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我需要知道如何停止C#Windows应用程序中的窗体上的鼠标单击.
我需要保持其他形式的应用程序处于活动状态,并且只需要禁用对此一种形式的点击.
我不想使用form.Enabled = false属性,因为它会使整个表单变灰.
我一直在寻找邮件过滤器,但无法正确使用它们.

请帮忙.

问候,
Saurabh

Hi ,
I need to know how can i stop the mouse click on the form in C# windows application.
i need to keep the other forms of the application active and need to disable clicks on just this one form.
i dont want to use the form.Enabled = false property as it greys out the entire form.
i have been looking in Message Filters but am unable to make proper use of them.

Please help.

Regards,
Saurabh

推荐答案

您应该使用Enabled,这就是它的作用.变灰是UI提示,因此您的应用程序用户知道表单将不响应输入,而不仅仅是认为它已崩溃.

您可以只具有一个布尔值标志,并检查Click或MouseDown事件中的内容,如果关闭"事件则不执行任何操作.
You should use Enabled, that''s what it''s there for. The greying out is a UI cue so that users of your application know that the form is not going to respond to input, instead of just thinking it crashed.

You can just have a boolean flag and check that in your Click or MouseDown events and not do anything if events are ''turned off''.


如果您不使用Enabled和使用户感到困惑,并使他们觉得自己像个白痴,一击又一击,却什么也没有发生.您想要什么,但您不应该想要.您的用户将通过您的应用程序将其真正所属的位置快速转储.别惹麻烦.

-SA
If you don''t use Enabled and confuse the user and make them feel like an idiot who clicks and clicks and nothing happens. What you want it possible, but you should not want it. Your users will through your application to dumpster real quick where it truly belongs. Don''t get yourself in trouble.

—SA


This Link-[Disabling mouse movement and clicks altogether in c#][^] might help you.


这篇关于如何停止在表格上的鼠标单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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