/// <summary> /// Changes a tab to the specified index /// </summary> /// <param name="index">The index to change to</param> public virtual void ChangeTab(int index) { if (index < 0 || index >= tabList.Count) { return; } if (index == currentTabIndex) { return; } if (currentTabIndex != -1) { tabList[currentTabIndex].Deselect(); } currentTabIndex = index; T data = tabList[currentTabIndex].Select(); TabChangedEventArgs <T> args = new TabChangedEventArgs <T>(data, index, tabList[currentTabIndex].tabName); OnTabChanged(args); parentControl.Invalidate(); }
/// <summary> /// Invokes the tab changed event /// </summary> /// <param name="e"></param> protected virtual void OnTabChanged(TabChangedEventArgs <T> e) => tabChanged?.Invoke(this, e);