public void AddTab(string url, int?insertIndex = null) { browserTabControl.SuspendLayout(); var browser = new BrowserTabUserControl(url, multiThreadedMessageLoopEnabled) { Dock = DockStyle.Fill, }; var tabPage = new TabPage(url) { Dock = DockStyle.Fill, Text = "Carregando...".PadRight(30) }; //This call isn't required for the sample to work. //It's sole purpose is to demonstrate that #553 has been resolved. browser.CreateControl(); tabPage.Controls.Add(browser); if (insertIndex == null) { //browserTabControl.TabPages.Add(tabPage); browserTabControl.TabPages.Insert(browserTabControl.TabCount - 1, tabPage); } else { browserTabControl.TabPages.Insert(insertIndex.Value, tabPage); } //Make newly created tab active browserTabControl.SelectedTab = tabPage; browserTabControl.ResumeLayout(true); }
private void LoadActualTab(string url) { treeViewSearch.Enabled = false; browserTabControl.SuspendLayout(); var tabPage = browserTabControl.Controls[browserTabControl.SelectedIndex]; var control = tabPage.Controls[0] as BrowserTabUserControl; tabPage.Controls.Remove(control); control.Dispose();//necessário para forçar reload sem cache para url parameters var browser = new BrowserTabUserControl(url, multiThreadedMessageLoopEnabled) { Dock = DockStyle.Fill, }; //This call isn't required for the sample to work. //It's sole purpose is to demonstrate that #553 has been resolved. browser.CreateControl(); tabPage.Controls.Add(browser); browserTabControl.ResumeLayout(true); treeViewSearch.Enabled = true; }