Beispiel #1
0
        void tbr_Click(object sender, EventArgs e)
        {
            int i;

            for (int k = 0; k < ((ToolStripMenuItem)sender).MergeIndex; k++)
            {
                int j = 0;
                for (i = ((ToolStripMenuItem)sender).MergeIndex; i >= 0; i--)
                {
                    ButtonX but  = buttonlist[i];
                    ButtonX temp = buttonlist[j];
                    buttonlist[i] = temp;
                    buttonlist[j] = but;

                    TabPanelControl uct1    = tabPanelCtrlList[i];
                    TabPanelControl tempusr = tabPanelCtrlList[j];
                    tabPanelCtrlList[i] = tempusr;
                    tabPanelCtrlList[j] = uct1;
                }
            }

            string btext = ((ToolStripMenuItem)sender).Text;

            BackToFront_SelButton();
            selected_index = 0;
            TabPanel.Controls.Add(tabPanelCtrlList[buttonlist[0].TabIndex]);
            UpdateButtons();
        }
Beispiel #2
0
 public void AddTab(string tabtext, TabPanelControl tpcontrol, bool showClose)
 {
     if (!buttonlist.Any())
     {
         createAndAddButton(tabtext, tpcontrol, new Point(0, 0), showClose);
     }
     else
     {
         createAndAddButton(tabtext, tpcontrol, new Point(buttonlist[buttonlist.Count - 1].Size.Width + buttonlist[buttonlist.Count - 1].Location.X, 0), showClose);
     }
 }
Beispiel #3
0
        void createAndAddButton(string tabtext, TabPanelControl tpcontrol, Point loc, bool showCloseButton)
        {
            ButtonX bx = new ButtonX();

            bx.DisplayText = tabtext;
            bx.Text        = tabtext;
            //  bx.Size = tab_size;
            int width = TextRenderer.MeasureText(tabtext, this.Font).Width + 20;

            if (width < tab_size.Width)
            {
                width = tab_size.Width;
            }
            bx.Size = new Size(width, tab_size.Height);

            bx.Location           = loc;
            bx.ForeColor          = sel_tab_forecolor;
            bx.BXBackColor        = sel_tab_backcolor;
            bx.MouseHoverColor    = sel_tab_backcolor;
            bx.MouseClickColor1   = sel_tab_backcolor;
            bx.ChangeColorMouseHC = false;
            bx.TextLocation_X     = txt_x_loc;
            bx.TextLocation_Y     = txt_y_loc;
            bx.Font                 = this.Font;
            bx.Click               += button_Click;
            bx.ShowCloseButton      = showCloseButton;
            bx.OnClickCloseHandler += Close_Button;
            TabButtonPanel.Controls.Add(bx);

            buttonlist.Add(bx);
            selected_index++;

            tabPanelCtrlList.Add(tpcontrol);
            TabPanel.Controls.Clear();
            TabPanel.Controls.Add(tpcontrol);

            UpdateButtons();
        }