Exemplo n.º 1
0
        /// <summary>
        /// Removes the currently selected tab from the tab control.
        /// </summary>
        /// <returns>
        /// <b>True</b> if the current tab was removed; otherwise, <b>False</b>.
        /// </returns>
        /// <remarks>
        /// There must always be at least one tab so the last tab cannot be removed.
        /// </remarks>
        public bool RemoveCurrentTab()
        {
            bool canRemove = this.TabCount > 2;

            if (canRemove)
            {
                RichTextBoxTabPage tab = this.SelectedRichTextBoxTabPage;
                this.TabPages.Remove(tab);
                tab.Dispose();
            }

            return(canRemove);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Adds a new, empty page to the tab control.
        /// </summary>
        /// <returns>
        /// The <see cref="RichTextBoxTabPage" /> that was added.
        /// </returns>
        public RichTextBoxTabPage AddTab()
        {
            RichTextBoxTabPage tab = new RichTextBoxTabPage();

            if (TabCount == 0)
            {
                TabPages.Insert(TabCount, tab);
            }
            else
            {
                TabPages.Insert(TabCount - 1, tab);
            }
            this.SelectedTab = tab;
            return(tab);
        }