如何取消或处置 WebBrowser 元素的当前导航
我正在开发一个 C#、.NET Framework 4.0 应用程序。它按顺序访问一些页面。有时我必须移至下一页而不等待上一页完成工作。如何取消 WebBrowser
元素之前的导航过程?
WebBrowser
元素使用 Internet Explorer。谢谢。
这就是我的导航方式
webBrowser1.Navigate("http://www.mywebsite.com/");
I am developing a C#, .NET Framework 4.0 application. It visits some pages with an order. Sometimes I have to move to the next page without waiting for the previous one to finish the job. How can I cancel the previous navigation process of the WebBrowser
element?
WebBrowser
element uses Internet Explorer. Thank you.
This is how I navigate
webBrowser1.Navigate("http://www.mywebsite.com/");
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
有两种直接方法可以做到这一点。首先,您可以简单地在代码中的某个位置调用 WebBrowser 的 Stop 方法。但是,如果您正在寻找一些更精细的控制,您可以连接到 WebBrowser 的 导航事件,并执行如下操作:
There's two immediate ways to do this. First, you could simply make a call somewhere in your code to the WebBrowser's Stop method. However, if you are looking for some more fine tuned control, you could wireup to the WebBrowser's Navigating event, and do something like this:
WebBrowser.Stop 方法
WebBrowser.Stop Method
WebBrowser1.Stop()
我记得有这样的东西。它取消当前的导航。
WebBrowser1.Stop()
I remember there being something like this. It cancels the current navigation.