webBrowser1打开连接不弹出到新窗口

private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
//将所有的链接的目标,指向本窗体
foreach (HtmlElement archor in this.webBrowser1.Document.Links)
{
     archor.SetAttribute(
"target", "_self");
}
//将所有的FORM的提交目标,指向本窗体
foreach (HtmlElement form in this.webBrowser1.Document.Forms)
{
    form.SetAttribute(
"target", "_self");
}
}
private void webBrowser1_NewWindow(object sender, CancelEventArgs e)
{
   e.Cancel
= true;
}
WebBrowser1.AllowWebBrowserDrop
=false;
WebBrowser1.WebBrowserShortcutsEnabled
=false;
WebBrowser1.IsWebBrowserContextMenuEnabled
=false

你可能感兴趣的:(WebBrowser)