/// <summary> /// Remove a tab /// </summary> /// <param name="item">The tab item to be removed</param> public void RemoveTab(TabItem item) { m_rgTabItems.Remove(item); item.Dispose(); if (m_rgTabItems.Count > 0) { this.SelectedTab = this.TabItems(0); } this.TabControl_SizeChanged(null, null); }
/// <summary> /// Add a tab into the tab control /// </summary> /// <param name="caption">The caption of the tab</param> /// <param name="icon">The icon of the tab</param> /// <param name="defaultWidth">The default width of the tab</param> /// <param name="tag">Additional user data stored in this tab</param> /// <returns>The newly added tab</returns> public TabItem AddTab(string caption, Image icon, int defaultWidth, object tag) { TabItem item; item = new TabItem(this, caption, icon, defaultWidth); item.Tag = tag; m_rgTabItems.Add(item); SelectedTab = item; this.TabControl_SizeChanged(null, null); return item; }