打开网址
private void button1_Click(object sender, System.EventArgs e)
{
object obj=null;
browser.Navigate("
http://mis.fjsteel.cn:8088/js",ref obj,ref obj,ref obj,ref obj);
}
在新窗口中打开
private void browser_NewWindow2(object sender, AxSHDocVw.DWebBrowserEvents2_NewWindow2Event e)
{
Form1 frm = new Form1();
frm.browser.RegisterAsBrowser=true;
frm.Show();
e.ppDisp=frm.browser.Application;
}
捕获WebBrowser内页面的事件,必须引用mshtml.dll
private void browser_NavigateComplete2(object sender, AxSHDocVw.DWebBrowserEvents2_NavigateComplete2Event e)
{
doc = (mshtml.IHTMLDocument2)browser.Document;
mshtml.IHTMLWindow2 win = doc.parentWindow as mshtml.IHTMLWindow2;
mshtml.HTMLDocumentEvents2_Event docEvents = doc as mshtml.HTMLDocumentEvents2_Event;
mshtml.HTMLWindowEvents2_Event winEvents = win as mshtml.HTMLWindowEvents2_Event;
docEvents.onclick += new HTMLDocumentEvents2_onclickEventHandler(docOnClick);
}
public bool docOnClick(mshtml.IHTMLEventObj sender)
{
label1.Text="你点击了该页页面!";
return true;
}
posted @
2006-07-29 16:12
New Yang Bo Element
阅读(
889)
评论()
编辑
收藏
举报