我尝试了两种方法:
wb.Navigate(Url,true);
当我使用此网络浏览器时,但WebBrowserDocumentCompleted
事件在页面加载后不会触发。 wb.Navigate(Url);
当我使用此WebBrowserDocumentCompleted
事件时,但是浏览器未出现在屏幕上。如何在同一时间显示外部浏览器并触发WebBrowserDocumentCompleted
事件?
private void button1_Click(object sender, EventArgs e)
{
System.Windows.Forms.WebBrowser wb = new System.Windows.Forms.WebBrowser();
wb.DocumentCompleted += WebBrowserDocumentCompleted;
wb.Visible = true;
wb.ScrollBarsEnabled = false;
wb.ScriptErrorsSuppressed = true;
wb.Navigate("http://www.google.com",true);
}
private void WebBrowserDocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
if ((sender as WebBrowser).ReadyState == System.Windows.Forms.WebBrowserReadyState.Complete)
{
// Do what ever you want to do here when page is completely loaded.
}
}