示例#1
0
        /// <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();
        }
示例#2
0
 /// <summary>
 /// Invokes the tab changed event
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnTabChanged(TabChangedEventArgs <T> e) => tabChanged?.Invoke(this, e);