/// <summary> /// Select the given tab. /// </summary> /// <param name="tab">Tab to select.</param> private void SelectTab(WhidbeyTabPage tab) { // Ignore if disabled if ((tab.State == TabState.Disabled) || (tab.Enabled == false)) { return; } // Unselect previous UnselectTab(); Unhover(); // Set selected tab.State = TabState.Selected; m_oSelected = tab; // Add new control to panel tab.ShowNotifty(true); tab.Visible = true; tab.Focus(); // Force redraw this.Invalidate(tab.ItemBounds); // Fire event EventHandler <WhidbeyTabEventArgs> ev = this.m_eSelected; if (ev != null) { ev(this, new WhidbeyTabEventArgs(tab)); } }
/// <summary> /// Select the currently selected tab. /// </summary> private void UnselectTab() { if (m_oSelected != null) { WhidbeyTabPage tab = m_oSelected; m_oSelected = null; tab.State = TabState.Normal; // Drop old control from the panel tab.ShowNotifty(false); tab.Visible = false; // Force redraw this.Invalidate(tab.ItemBounds); } }