zoukankan      html  css  js  c++  java
  • webbowser 弹出新窗口固定在本窗口的方法

    控件 webbowser 在使用过程中,当网页需要弹出新窗口的时候 往往会打开IE浏览器,但是有时候想固定在本窗口 不想打开新的IE窗口,这需要使用如下方法

       (this.webBrowser1.ActiveXInstance as SHDocVw.WebBrowser).NewWindow3 += (new DWebBrowserEvents2_NewWindow3EventHandler(this.Form1_NewWindow));
                //(this.webBrowser1.ActiveXInstance as SHDocVw.WebBrowser).Silent = true;

           private void Form1_NewWindow(ref object ppDisp, ref bool Cancel, uint dwFlags, string UrlContext, string Url)
            {
             
                    this.webBrowser1.Navigate(Url);
                    Cancel = true;
                }
            }

    添加这个事件,并在事件中处理即可。

  • 相关阅读:
    MongoDB
    新公司管理经营
    剪辑理论
    色彩理论
    商业模式
    电影手法
    [好文转载] 每个程序员都应该学习使用Python或Ruby
    File类递归
    【CF1447】div2复盘
    【心得体会】11.9-11.15
  • 原文地址:https://www.cnblogs.com/liaoyi/p/9016209.html
Copyright © 2011-2022 走看看