Application.DoEvents() 的使用 [英] Use of Application.DoEvents()

查看:36
本文介绍了Application.DoEvents() 的使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Application.DoEvents()可以在C#中使用吗?

这个函数是否是一种允许 GUI 赶上应用程序其余部分的方式,与 VB6 的 DoEvents 的方式大致相同?

Is this function a way to allow the GUI to catch up with the rest of the app, in much the same way that VB6's DoEvents does?

推荐答案

根据我的经验,我建议在 .NET 中使用 DoEvents 时要非常谨慎.在包含 DataGridViews 的 TabControl 中使用 DoEvents 时,我遇到了一些非常奇怪的结果.另一方面,如果您处理的只是一个带有进度条的小表单,那么它可能没问题.

From my experience I would advise great caution with using DoEvents in .NET. I experienced some very strange results when using DoEvents in a TabControl containing DataGridViews. On the other hand, if all you're dealing with is a small form with a progress bar then it might be OK.

最重要的是:如果您打算使用 DoEvents,那么您需要在部署应用程序之前对其进行彻底的测试.

The bottom line is: if you are going to use DoEvents, then you need to test it thoroughly before deploying your application.

这篇关于Application.DoEvents() 的使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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