本人初学者,高分急问
如题,原来在ie浏览器中的网页上的连接点击后会打开一个新的窗口显示页面,现在把该网页做到form里的webBrowser里,让页面上的连接打开的网页就在本form中打开,而不是新创建一个带有webBrowser的form,可不可以实现,请高手帮帮我啊,万分感谢

解决方案 »

  1.   

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using System.Reflection;
    namespace WindowsApplication24
    {
        public partial class Form1 : Form
        {
            
            public Form1()
            {
                InitializeComponent();
                this.webBrowser1.Navigate("about:blank");
                (this.webBrowser1.ActiveXInstance as SHDocVw.WebBrowser).NewWindow3 += new SHDocVw.DWebBrowserEvents2_NewWindow3EventHandler(Form1_NewWindow3);        }        void Form1_NewWindow3(ref object ppDisp, ref bool Cancel, uint dwFlags, string bstrUrlContext, string bstrUrl)
            {
                Cancel = true;
                this.webBrowser1.Navigate(bstrUrl);
            }
            private void button1_Click(object sender, EventArgs e)
            {
                this.webBrowser1.Navigate("www.google.cn");
            }               
        }
    }
      

  2.   

    谢谢你,可是我要用的网站类似新浪的网站,有一个弹出广告,等webBrowser里的页面完全打开后就成广告那页了,请问该怎么屏蔽掉广告页,或者怎么解决呢?
      

  3.   

    可我的程序必须这样才能进行下去,我的任务是自动登陆该网站,读取里面的数据写入数据库,如果弹出网页搞不定,就不好进行下一步,请问如何根据网址来判断,能给个例子吗?我看有人说可以通过过滤网站上的windows.open来使打开的网页没有弹出页面,可具体不知道该怎么操作,请帮帮忙,十分感谢
      

  4.   

    OK,我自己解决了,还是很感谢jinjazz的帮助和提示,下面我要研究的就是如何模拟鼠标点击自动打开目标连接了