WebBrowser.IsBusy 在.Net 4.0中的BUG

本文探讨了.NET Framework中WebBrowser控件的IsBusy属性与ReadyState属性之间的关系。当遇到IsBusy始终为true的情况,即使ReadyState显示为Complete,文章提出了一种解决方案,通过结合两个属性来准确判断浏览器控件的状态。

属性IsBusy在文档中说明(http://msdn.microsoft.com/en-us/library/ek4h3t66(v=VS.100).aspx?appId=Dev10IDEF1&l=EN-US&k=k(SYSTEM.WINDOWS.FORMS.WEBBROWSER.ISBUSY)%3bk(ISBUSY)%3bk(TargetFrameworkMoniker-%22.NETFRAMEWORK&k=VERSION%3dV4.0%22)%3bk(DevLang-CSHARP)&rd=true):
If this property is true, you can use the Stop method to halt the current navigation before the new document is fully loaded. Use the ReadyState property to determine the exact navigation state of the WebBrowser control. The IsBusy property value is false when the ReadyState property value is WebBrowserReadyState.Complete.

但是实际上遇到了IsBusy一直是true,但检查ReadyState即为WebBrowserReadyState.Complete,郁闷了,于是不得已使用
IsBusy && this.ReadyState != WebBrowserReadyState.Complete

来检测是否是忙,或者使用this.ReadyState != WebBrowserReadyState.Complete也得,但为了安全起见还是多写一点吧

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值