void WebBrowser_Quit(object sender, EventArgs e) { // This event is launched when window.close() is called from script ExtendedWebBrowser brw = sender as ExtendedWebBrowser; if (brw == null) { return; } // See which page it was on... BrowserControl bc = BrowserControlFromBrowser(brw); if (bc == null) { return; } MainForm form = bc.Tag as MainForm; if (form != null) { form.Close(); } form.Dispose(); }
void WebBrowser_StatusTextChanged(object sender, EventArgs e) { // First, see if the active page is calling, or another page ExtendedWebBrowser ewb = sender as ExtendedWebBrowser; // Return if we got nothing (shouldn't happen) if (ewb == null) { return; } // Yep, send the event that updates the status bar text this.toolStripStatusLabel.Text = ewb.StatusText; }
void WebBrowser_DocumentTitleChanged(object sender, EventArgs e) { // Update the title of the tab page of the control. ExtendedWebBrowser ewb = sender as ExtendedWebBrowser; // Return if we got nothing (shouldn't happen) if (ewb == null) { return; } string documentTitle = ewb.DocumentTitle; if (!string.IsNullOrEmpty(documentTitle) && !conf.Fixtitle) { this.Text = ewb.DocumentTitle; } }
public BrowserControl() { InitializeComponent(); _browser = new ExtendedWebBrowser(); //_browser.ScriptErrorsSuppressed = true; _browser.Quit += new EventHandler(_browser_Quit); _browser.Dock = DockStyle.Fill; _browser.DownloadComplete += new EventHandler(_browser_DownloadComplete); _browser.Navigated += new WebBrowserNavigatedEventHandler(_browser_Navigated); _browser.StartNewWindow += new EventHandler <BrowserExtendedNavigatingEventArgs>(_browser_StartNewWindow); _browser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(_browser_DocumentCompleted); this.containerPanel.Controls.Add(_browser); // Make the magenta color transparent on the go button Bitmap bmp = (Bitmap)goButton.Image; bmp.MakeTransparent(Color.Magenta); panel2.Visible = Global.sysConfig.WindowConfig.Toolbar; }
void WebBrowser_DocumentTitleChanged(object sender, EventArgs e) { // Update the title of the tab page of the control. ExtendedWebBrowser ewb = sender as ExtendedWebBrowser; // Return if we got nothing (shouldn't happen) if (ewb == null) { return; } // This is a little nasty. The Extended Web Browser is nested in // a panel, wich is nested in the browser control BrowserControl bc = BrowserControlFromBrowser(ewb); // If we got null, return if (bc == null) { return; } // The Tag of the BrowserControl should point to the TabPage MainForm manForm = bc.Tag as MainForm; // If not, return if (manForm == null) { return; } // Update the tabPage // Keep it user-friendly, don't do those awful long web page titles // in tabs and make sure the title is never empty string documentTitle = ewb.DocumentTitle; if (!string.IsNullOrEmpty(documentTitle)) { manForm.Text = ewb.DocumentTitle; } }
private static BrowserControl BrowserControlFromBrowser(ExtendedWebBrowser browser) { // This is a little nasty. The Extended Web Browser is nested in // a panel, wich is nested in the browser control // Since we want to avoid a NullReferenceException, do some checking // Check if we got a extended web browser if (browser == null) { return(null); } // Check if it got a parent if (browser.Parent == null) { return(null); } // Return the parent of the parent using a safe cast. return(browser.Parent.Parent as BrowserControl); }
public void Open(Uri url) { ExtendedWebBrowser browser = this.New(url.ToString()); browser.Navigate(url); }
public WebBrowserExtendedEvents(ExtendedWebBrowser browser) { _Browser = browser; }