public override void Remove(Control value) { base.Remove(value); if (value is TabPage == false) { return; } int index = owner.FindTabPage((TabPage)value); int curSelectedIndex = owner.SelectedIndex; if (index != -1) { owner.RemoveTabPage(index); if (index == curSelectedIndex) { owner.SelectedIndex = 0; } } }
public override void Remove(Control value) { base.Remove(value); if (!(value is TabPage)) { return; } int index = _owner.FindTabPage((TabPage)value); int curSelectedIndex = _owner.SelectedIndex; if (index != -1) { _owner.RemoveTabPage(index); if (index == curSelectedIndex) { // Always select the first tabPage is the Selected TabPage is removed. _owner.SelectedIndex = 0; } } _owner.UpdateTabSelection(false); }
public override void Remove(Control item) { base.Remove(item); var page = item as TabPage; if (page == null) { return; } int index = owner.FindTabPage(page); int curSelectedIndex = owner.SelectedIndex; if (index != -1) { owner.RemoveTabPage(index); if (index == curSelectedIndex) { owner.SelectedIndex = 0; } } }