private void NewFrontBrowser() { m_frontBrowserHost = new WebBrowserHost(); m_frontBrowserHost.JavaScript = m_javaObject; m_frontBrowserHost.MdiParent = this; m_frontBrowserHost.Dock = DockStyle.Fill; m_frontBrowserHost.DocumentCompleted += m_BrowserHost_DocumentCompleted; m_frontBrowserHost.Show(); m_frontBrowserHost.SendToBack(); }
public MultiWebbrowserImp() { InitializeComponent(); m_javaObject = new JavaScriptObject(HtmlRender.SingleInstance); m_frontBrowserHost = new WebBrowserHost(); m_backBrowserHost = new WebBrowserHost(); m_frontBrowserHost.JavaScript = m_javaObject; m_backBrowserHost.JavaScript = m_javaObject; m_frontBrowserHost.MdiParent = this; m_backBrowserHost.MdiParent = this; m_frontBrowserHost.Dock = DockStyle.Fill; m_backBrowserHost.Dock = DockStyle.Fill; m_frontBrowserHost.DocumentCompleted += m_BrowserHost_DocumentCompleted; m_backBrowserHost.DocumentCompleted += m_BrowserHost_DocumentCompleted; m_frontBrowserHost.Show(); m_backBrowserHost.Show(); m_curBrowserHost = m_backBrowserHost; this.DoubleBuffered = true; this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.UserPaint, true); MdiClient client = null; for (int i = 0; i < this.Controls.Count; ++i) { client = this.Controls[i] as MdiClient; if (null != client) { int style = NativeWndApi.GetWindowLong(client.Handle, NativeWndApi.GWL_STYLE); int exStyle = NativeWndApi.GetWindowLong(client.Handle, NativeWndApi.GWL_EXSTYLE); style &= ~NativeWndApi.WS_BORDER; exStyle &= ~NativeWndApi.WS_EX_CLIENTEDGE; NativeWndApi.SetWindowLong(client.Handle, NativeWndApi.GWL_STYLE, style); NativeWndApi.SetWindowLong(client.Handle, NativeWndApi.GWL_EXSTYLE, exStyle); UpdateStyles(); } } this.KeyDown += new KeyEventHandler(MultiWebbrowserImp_KeyDown); this.FormClosing += new FormClosingEventHandler(MultiWebbrowserImp_FormClosing); }
public bool Navigate(string argUrl) { WebBrowserHost old = m_curBrowserHost; try { lock (m_locker) { //WebBrowserHost nextHost = NextWebBrowserHost; //m_curBrowserHost = nextHost; //nextHost.Navigate(argUrl); (m_curBrowserHost = NextWebBrowserHost).Navigate(argUrl); } } catch (System.Exception ex) { Log.UIService.LogError(string.Format("Failed to navigage new address[{0}]", argUrl), ex); //m_curBrowserHost = old; return(false); } return(true); }