private void CloseTab(int tabIndex)
        {
            if (BeforeCloseTab != null)
            {
                var e = new BeforeCloseTabEventArgs {
                    TabIndex = tabIndex
                };
                BeforeCloseTab(this, e);
                if (e.Cancel)
                {
                    return;
                }
            }
            TabPages.Remove(TabPages[tabIndex]);

            // Select a new tab
            if (tabIndex > 0)
            {
                this.SelectedIndex = tabIndex - 1;
            }
            else if (this.TabCount > 0)
            {
                this.SelectedIndex = 0;
            }
            else
            {
                this.SelectedIndex = -1;
            }

            lock (mhs)
            {
                mhs.IsHovering  = false;
                mhs.EnableHover = false;
                mhs.TabIndex    = -1;
            }
        }
Exemplo n.º 2
0
        private void CloseTab(int tabIndex)
        {
            if (BeforeCloseTab != null)
            {
                var e = new BeforeCloseTabEventArgs { TabIndex = tabIndex };
                BeforeCloseTab(this, e);
                if (e.Cancel) return;
            }
            TabPages.Remove(TabPages[tabIndex]);

            // Select a new tab
            if (tabIndex > 0)
                this.SelectedIndex = tabIndex - 1;
            else if (this.TabCount >0)
                this.SelectedIndex = 0;
            else
                this.SelectedIndex = -1;

            lock(mhs)
            {
                mhs.IsHovering = false;
                mhs.EnableHover = false;
                mhs.TabIndex = -1;
            }
        }