Ejemplo n.º 1
0
 private void RemoveTab()
 {
     if (tabControl1.TabPages.Count == 1)
     {
         tabControl1.TabPages.Remove(tabControl1.SelectedTab);
         TabCount -= 1;
         toolStripStatusLabel1.Text = "Number of Tabs : " + TabCount.ToString();
         disable();
     }
     else if (tabControl1.TabPages.Count >= 1)
     {
         tabControl1.TabPages.Remove(tabControl1.SelectedTab);
         TabCount -= 1;
         toolStripStatusLabel1.Text = "Number of Tabs : " + TabCount.ToString();
     }
     else
     {
         MessageBox.Show("You have no documents to close", "Attention", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning);
     }
 }
Ejemplo n.º 2
0
        private void AddTab()
        {
            RichTextBox Body = new RichTextBox();

            Body.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                 | System.Windows.Forms.AnchorStyles.Left)
                                                                | System.Windows.Forms.AnchorStyles.Right)));
            Body.Size       = new System.Drawing.Size(658, 531);
            Body.Location   = new System.Drawing.Point(165, 3);
            Body.TabIndex   = 0;
            Body.AcceptsTab = true;
            Body.Name       = "Body";
            Spelling.SetSpellCheckerSettings(Body, new Infragistics.Win.UltraWinSpellChecker.SpellCheckerSettings(true));
            Body.AutoWordSelection  = true;
            Body.EnableAutoDragDrop = true;
            Body.MouseDown         += new System.Windows.Forms.MouseEventHandler(kasozi);
            menu.Style       = MenuStyle.Office2013;
            Body.ContextMenu = menu;


            TabPage NewPage = new TabPage();

            NewPage.BackColor = System.Drawing.SystemColors.ActiveCaption;
            NewPage.ForeColor = System.Drawing.SystemColors.Highlight;
            NewPage.Location  = new System.Drawing.Point(4, 32);
            NewPage.Padding   = new System.Windows.Forms.Padding(3);
            NewPage.Size      = new System.Drawing.Size(1023, 547);
            NewPage.TabIndex  = 0;
            TabCount         += 1;
            string DocumentText = "Document " + TabCount;

            NewPage.Name = DocumentText;
            NewPage.Text = DocumentText;
            NewPage.Controls.Add(Body);
            tabControl1.TabPages.Add(NewPage);
            toolStripStatusLabel1.Text = "Number of Tabs : " + TabCount.ToString();
        }