Exemplo n.º 1
0
        /// <summary>
        /// Raise when a new tab page added
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tabControl_ControlAdded(object sender, ControlEventArgs e)
        {
            //We cannot use TabControlMethods.CurrentArea
            //Because this event raise before the SelectedTab is set.
            MyRichTextBox currentRTB  = tabControl.TabPages[tabControl.TabPages.Count - 1].Controls[0] as MyRichTextBox;
            TypingArea    currentArea = currentRTB.TypingArea;

            //Set the event handler helping update status bar
            currentArea.TextChanged += TextArea_TextChanged;
        }
Exemplo n.º 2
0
        public static TabPage CreateNewTabPage(String tabName)
        {
            TabPage newTabPage = new TabPage(tabName);

            InitTabPageInfo(newTabPage);

            //Add the MyRichTextBox inside
            MyRichTextBox myRichText = new MyRichTextBox();

            newTabPage.Controls.Add(myRichText);
            myRichText.Dock = DockStyle.Fill;

            TabControl.TabPages.Add(newTabPage);

            //Switch to the new tabpage
            TabControl.SelectedTab = newTabPage;

            return(newTabPage);
        }