public void DetachContent() { content.TitleNameChanged -= new EventHandler(SetTitleEvent); content.DirtyChanged -= new EventHandler(SetTitleEvent); content = null; if (viewTabControl != null) { foreach (TabPage page in viewTabControl.TabPages) { if (viewTabControl.SelectedTab == page && page.Tag is IBaseViewContent) { ((IBaseViewContent)page.Tag).Deselecting(); } page.Controls.Clear(); if (viewTabControl.SelectedTab == page && page.Tag is IBaseViewContent) { ((IBaseViewContent)page.Tag).Deselected(); } } viewTabControl.Dispose(); viewTabControl = null; } Controls.Clear(); }
internal DevCap() { if (Environment.OSVersion.Platform == PlatformID.WinCE) { try { // TODO: Is there a smarter way to determine this is a Ppc or Sp? TabControl ctrl = new TabControl(); ctrl.Dispose(); Lvl = DevCapLvl.PocketPc; Res = Screen.PrimaryScreen.Bounds.Width > PocketPcNormWidth? ResLvl.High : ResLvl.Normal; } catch (NotSupportedException) { Lvl = DevCapLvl.Smartphone; Res = Screen.PrimaryScreen.Bounds.Width > SmartphoneNormWidth? ResLvl.High : ResLvl.Normal; } } else { // TODO: Currently this seems to be correct. That is, if Platform is // not WinCE then we have full access to .NET Framework. If this ever // changes this branch has to be modified. Lvl = DevCapLvl.Desktop; Res = ResLvl.Normal; } }
internal void Close() { Container.Resize -= Container_Resize; DiagnosticsStateManager.OnDiagContextCreated -= OnDiagContextCreated; _tabs.TabPages.Clear(); _tabs.Dispose(); }
void ReleaseDesignerOutlets() { if (btnHomeSearch != null) { btnHomeSearch.Dispose(); btnHomeSearch = null; } if (btnMenu != null) { btnMenu.Dispose(); btnMenu = null; } if (mnuStockMenu != null) { mnuStockMenu.Dispose(); mnuStockMenu = null; } if (TabControl != null) { TabControl.Dispose(); TabControl = null; } if (TableViewStock != null) { TableViewStock.Dispose(); TableViewStock = null; } }
[Test] // bug #81802. should not throw an exception public void NoTabPages2() { Form form = new Form(); form.Font = new Font("Tahoma", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0))); TabControl tab = new TabControl(); form.Controls.Add(tab); tab.Dispose(); form.Dispose(); }
void ClearContent() { this.Controls.Clear(); if (viewTabControl != null) { foreach (TabPage page in viewTabControl.TabPages) { page.Controls.Clear(); } viewTabControl.Dispose(); viewTabControl = null; } }
public void RemoveControlOnDisposedTabControlTest() { var hyperToolTipProvider = new HyperToolTipProvider(); var id = "id"; var tabCtrl = new TabControl(); var page = new TabPage(); tabCtrl.Controls.Add(page); hyperToolTipProvider.SetHyperToolTipId(page, id); Assert.AreEqual(id, hyperToolTipProvider.GetHyperToolTipId(page)); tabCtrl.Dispose(); Assert.AreEqual( string.Empty, hyperToolTipProvider.GetHyperToolTipId(page), "control is not deregistered automatically"); }
protected override void Dispose(bool disposing) { listBox.LostFocus -= ListBox_LostFocus; listBox.DrawItem -= ListBox_DrawItem; textBox.KeyUp -= TextBox_KeyUp; labelExtension.Paint -= LabelExtension_Paint; tabControl.SelectedIndexChanged -= TabControl_SelectedIndexChanged; tabControl.DrawItem -= tabControl_DrawItem; listBox.Dispose(); textBox.Dispose(); labelExtension.Dispose(); for (int i = 0; i < tabPages.Count; i++) { tabPages[i].Dispose(); } tabControl.Dispose(); base.Dispose(disposing); }
// zamyka okno wyświetlania emaili, aktualizując nowe emaile w razie potrzeby i zapisując zmiany na dysk private void closeEmailsDisplayWindow() { infoButtonMessage = ""; //wychwytuję zaznaczone emaile w każdej zakładce, ale tylko wtedy gdy wyświetlona była lista nowych maili if (emailsDisplayed == EmailListType.newEmails) { Control.ControlCollection tabControlContent = emailDisplayTabControl.Controls; checkedEmailsDict.Clear(); int numberOfCheckedEmails = 0; //jeżeli zero, to nie wywołuję funkcji aktualizacji foreach (Control c in tabControlContent) //tzn dla każdego konta mailowego { TabPage page = c as TabPage; string accountName = page.Text; Control.ControlCollection tabPageContent = page.Controls; ListView emailsDisplay = tabPageContent[0] as ListView; //każdy tab zawiera tylko jedną listę ListView.CheckedListViewItemCollection checkedItems = emailsDisplay.CheckedItems; List <IEmailMessage> checkedEmails = new List <IEmailMessage>(); foreach (ListViewItem item in checkedItems) { IEmailMessage message = item.Tag as IEmailMessage; checkedEmails.Add(message); } checkedEmailsDict.Add(accountName, checkedEmails); numberOfCheckedEmails += checkedEmails.Count; } if (numberOfCheckedEmails > 0) { //aktualizuję słownik i zapisuję zmiany na dysk updateEmailLists(); saveDataToFile(); } } //dopiero po wychwyceniu zaznaczonych emaili zamykam okno emailDisplayTabControl.Dispose(); infoLabel.Dispose(); setMainFormStartSettings(); }
void PluginTabsMouseClick(object sender, System.Windows.Forms.MouseEventArgs e) { if (e.Button == MouseButtons.Middle) { for (int i = 0; i < PluginTabs.TabPages.Count; i++) { if (PluginTabs.GetTabRect(i).Contains(e.Location)) { RemovePage(PluginTabs.TabPages[i]); break; } } } //if there is only one plugin left, remove the TabControl if (PluginTabs.TabCount == 1) { TabPage page = PluginTabs.TabPages[0]; page.Controls[0].Parent = MainPanel; RemovePage(page); PluginTabs.Dispose(); PluginTabs = null; } }
void ReleaseDesignerOutlets() { if (btnMenu != null) { btnMenu.Dispose(); btnMenu = null; } if (btnSearch != null) { btnSearch.Dispose(); btnSearch = null; } if (btnSearchCategory != null) { btnSearchCategory.Dispose(); btnSearchCategory = null; } if (btnSearchClose != null) { btnSearchClose.Dispose(); btnSearchClose = null; } if (btnSearchDone != null) { btnSearchDone.Dispose(); btnSearchDone = null; } if (btnSearchKarat != null) { btnSearchKarat.Dispose(); btnSearchKarat = null; } if (btnSearchRegion != null) { btnSearchRegion.Dispose(); btnSearchRegion = null; } if (btnSearchWorkType != null) { btnSearchWorkType.Dispose(); btnSearchWorkType = null; } if (mnuStockMenu != null) { mnuStockMenu.Dispose(); mnuStockMenu = null; } if (pnlCloseout != null) { pnlCloseout.Dispose(); pnlCloseout = null; } if (pnlSearch != null) { pnlSearch.Dispose(); pnlSearch = null; } if (pnlStock != null) { pnlStock.Dispose(); pnlStock = null; } if (searchDisplayController != null) { searchDisplayController.Dispose(); searchDisplayController = null; } if (TabControl != null) { TabControl.Dispose(); TabControl = null; } if (TableViewStock != null) { TableViewStock.Dispose(); TableViewStock = null; } if (txtCategory != null) { txtCategory.Dispose(); txtCategory = null; } if (txtKarat != null) { txtKarat.Dispose(); txtKarat = null; } if (txtRegion != null) { txtRegion.Dispose(); txtRegion = null; } if (txtSearchBar != null) { txtSearchBar.Dispose(); txtSearchBar = null; } if (txtWorkType != null) { txtWorkType.Dispose(); txtWorkType = null; } }
private void PopulateConfig() { if (t != null) //This condition has been added to dispose the tabcontrol since it was consuming user objects. { t.Dispose(); //t = null; } { t = new TabControl(); } t.Multiline = true; t.Size = new System.Drawing.Size(this.Width, this.Height - (int)tableLayoutPanel1.RowStyles[1].Height); { config = new Config_UC(); KeyValuePair <string, object> temp = config.rootDict; Dictionary <string, object> dic = temp.Value as Dictionary <string, object>; FieldInfo[] f = Config_UC.fieldInfos; foreach (FieldInfo val in f) { if (val.Name.Equals("fileName")) { break; } TabPage tPage = new TabPage(); FieldInfo[] tempFieldInfo = val.FieldType.GetFields(System.Reflection.BindingFlags.Public | BindingFlags.Instance); object obj = val.GetValue(ConfigVariables.CurrentSettings); string output = ""; //This below foreach has been added by Darshan on 08-09-2015 to solve Defect no 0000631: The spaces are not left for the Labels in settings window. foreach (char letter in val.Name) { if (Char.IsUpper(letter) && output.Length > 0) { output += " " + letter; } else { output += letter; } } tPage.Text = output; tPage.AutoScroll = true; if (tempFieldInfo.Count() != 0) { config.vIndent = 10; config.addBranchL(tempFieldInfo, val.Name, 1, tPage, obj); } else { PropertyInfo[] pinf = val.FieldType.GetProperties(System.Reflection.BindingFlags.Public | BindingFlags.Instance); config.vIndent = 10; config.addBranchL(pinf, val.Name, 1, tPage, obj); } t.Controls.Add(tPage); //tPage.Dispose(); } t.Dock = DockStyle.Fill; } // this.Controls.Add(t); // config.Dock = DockStyle.Fill; tableLayoutPanel1.Controls.Add(t, 0, 0); }
public PagerControl(ref TabControl tc, Panel panel = null) { if (panel != null) { this._mainPanel = panel; } else if (tc.Parent is Panel) { this._mainPanel = (Panel)tc.Parent; } else { throw new InvalidOperationException("PagerControl needs Panel parameter or the TabControl must reside in a panel."); } foreach (TabPage tabPage in tc.TabPages) { this.PageTitles.Add(tabPage.Text); Panel p = new Panel { Margin = new Padding(0, 0, 0, 0), Padding = new Padding(0, 0, 0, 0), Dock = DockStyle.Fill, Visible = false, AutoScroll = true, }; this._mainPanel.Controls.Add(p); ArrayList controls = new ArrayList(tabPage.Controls); foreach (Control c in controls) { if (c.Width == 0) // fixed errors with controls autosizing to zero if they have no content or they are docked without a parent { c.Width = 1; } if (c.Height == 0) { c.Height = 1; } p.Controls.Add(c); } bool subTitle = false; bool flags = false; foreach (Label lab in FormHelper.EnumerateControls <Label>(p)) { if (lab.Text.StartsWith("^^^")) { this.PageFlags.Add(lab.Text.Substring(3)); flags = true; lab.Visible = false; } else if (lab.Text.StartsWith("^^")) { this.PageSubTitles.Add(lab.Text.Substring(2)); subTitle = true; lab.Visible = false; } } if (!subTitle) { this.PageSubTitles.Add(null); } if (!flags) { this.PageFlags.Add(""); } tabPage.Controls.Clear(); this.Pages.Add(p); } tc.Parent.Controls.Remove(tc); tc.Dispose(); tc = null; this.GotoPage(0); }