这句出错
(this.axWebBrowser1.GetOcx() as SHDocVw.WebBrowser).NewWindow2 += new AxSHDocVw.DWebBrowserEvents2_NewWindow2EventHandler(this, this.Form1_NewWindow2);
我的this.form1_newwindow2就是方法啊,方法如下,不知道哪里出错了,请教高手
private void Form1_NewWindow2(ref object ppDisp, ref bool Cancel)
{
int num = 0;
int num2 = 0;
int num3 = 0;
int num4 = 0;
IHTMLDocument2 document = this.axWebBrowser1.Document as IHTMLDocument2;
IHTMLElement element = document.all.item("hShowScale", 0) as IHTMLElement;
string str = element.getAttribute("value", 0).ToString();
if (str != "")
{
element.setAttribute("value", "", 0);
string[] strArray = str.Split(new char[] { ',' });
num = int.Parse(strArray[0]);
num2 = int.Parse(strArray[1]);
num3 = int.Parse(strArray[2]);
num4 = int.Parse(strArray[3]);
int.Parse(strArray[4]);
Form5 form = new Form5();
form.Left=num;
form.Top=num2;
form.Width=num3;
form.Height=num4;
ppDisp = form.axWebBrowser1.GetOcx();
form.Show();
}
}
private void FrmMain_Load(object sender, EventArgs e)
{
this.webBrowser1.Navigate("about:blank");
(this.webBrowser1.ActiveXInstance as SHDocVw.WebBrowser).NewWindow2 += new SHDocVw.DWebBrowserEvents2_NewWindow2EventHandler(NewWindow2);
} private void NewWindow2(ref object ppDisp, ref bool Cancel)
{
(webBrowser1.ActiveXInstance as SHDocVw.WebBrowser).RegisterAsBrowser = true;
ppDisp = (webBrowser1.ActiveXInstance as SHDocVw.WebBrowser).Application;
}
与底下的函数
private void NewWindow2(ref object ppDisp, ref bool Cancel)
{
(webBrowser1.ActiveXInstance as SHDocVw.WebBrowser).RegisterAsBrowser = true;
ppDisp = (webBrowser1.ActiveXInstance as SHDocVw.WebBrowser).Application;
}两个参数,这在我电脑上就提示出错