禁用点击按钮事件C# [英] Disable click button event c#
本文介绍了禁用点击按钮事件C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Visual Studio 2013 C#中编程.我想具有短时禁用按钮的功能.我尝试了 button.Enabled = false
,但是我看到在禁用它的情况下单击它时,在我在程序的其他位置启用该按钮后,单击操作立即开始.
I program in Visual Studio 2013 C#.
I want to have a functionality to disable for short time a button.
I tried button.Enabled=false
, but I see that when I click it during it is disabled then the click action starts right after I get that button enabled in other place of the program.
如何在禁用按钮时清除该事件或阻止它们?
How to clear that event or block them when button is disabled?
最诚挚的问候,Krzysztof
Best regards, Krzysztof
推荐答案
单击禁用按钮.
button1.Click -= button1_Click; // here button1_Click is your event name
单击启用按钮.
button1.Click += button1_Click; // here button1_Click is your event name
这篇关于禁用点击按钮事件C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文