问题描述
下午全部,
我使用左手功能区控制我加载MDI儿童表格,我的问题是他们中的一些有一个对它们进行大量控制,因此在激活时需要几秒钟来重新启动线程。
我这里关注的是,如果我多次单击功能区按钮,它会导致HRESULT E_FAIL -2147467259返回错误代码,这很好,但是因为表单被加载,卸载和重新加载多次导致应用程序挂起。
当用户点击按钮我在处理时按钮被禁用,并在完成后再次重新启用,我的问题就在这里。如何在线程繁忙时让程序停止排队点击事件
因此我们知道我们无法在禁用时点击事件但是因为事件正在排队当线程被释放时,它会处理下一个被触发的事件 - 我希望完全阻止此区域的进一步点击,直到线程被释放。
有什么想法?
问候
Dev
Afternoon All,
I am using a left hand ribbon control i made to load up MDI Child Forms, the problem i have is that some of them have a significant amount of controls on them so takes a few seconds upon activation to relase the thread.
My concern here is that if i multiple click the ribbon button it results in a HRESULT E_FAIL -2147467259 error code being returned which is fine but then becuase the form is being loaded,unloaded and reloaded multiple times causing the application to hang.
When the user clicks the button i have the button disable while it processing and the re-enable again after it is finished, my question is here. how do i get the program to stop queueing click events whilst the thread is busy
so we know we cant click on things when disabled but becuase the event is being queued up and when the thread is released it then processes the next fired event - i want to completely prevent further clicks in this area until the thread is released.
Any thoughts?
Regards
Dev
推荐答案
这篇关于主线程忙时如何防止点击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!