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
posted on 2009-12-04 17:41  米高佐敦  阅读(335)  评论(0编辑  收藏  举报