WebBrowser.IsBusy 在.Net 4.0中的BUG

本文探讨了在.NET Framework中使用WebBrowser控件时遇到的一个问题:IsBusy属性始终为true,而ReadyState属性却指示加载已完成。文章提出了通过IsBusy结合ReadyState属性判断WebBrowser控件实际状态的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

属性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也得,但为了安全起见还是多写一点吧

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值