以下是代码片段:#region 当右键点击在新窗口打开时打开新窗口 void Form1_NewWindow3(ref object ppDisp, ref bool Cancel, uint dwFlags, string bstrUrlContext, string bstrUrl) { int index = bstrUrl.LastIndexOf("/"); int index_s = bstrUrl.Length - 5; string domain = bstrUrl.Substring(index+1, index_s - index-1); Cancel = true; try { System.Windows.Forms.WebBrowser wb = new System.Windows.Forms.WebBrowser(); string strurl = webBrowser1.Document.ActiveElement.GetAttribute("href"); wb.Url = new System.Uri(strurl, System.UriKind.Absolute);
tabControl1.TabPages.Add(domain); wb.Dock = DockStyle.Fill; tabControl1.TabPages[tabControl1.TabPages.Count - 1].Controls.Add(wb); } catch { } } #endregion
Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved. 闵涛 E_mail:admin@mintao.net(欢迎提供学习资源)
鄂公网安备 42011102001154号
站长:MinTao ICP备案号:鄂ICP备11006601号-18