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(); }
void createAndAddButton(string tabtext, TabPanelControl tpcontrol, Point loc) { ButtonX b = new ButtonX(); b.DisplayText = tabtext; b.Text = tabtext; b.Size = new Size(130, 23); b.Location = loc; b.ForeColor = Color.White; b.BXBackColor = Color.FromArgb(37, 37, 38); b.MouseHoverColor = Color.FromArgb(20, 120, 240); b.MouseClickColor1 = Color.FromArgb(20, 80, 200); b.ChangeColorMouseHC = false; b.TextLocation_X = 10; b.TextLocation_Y = 9; b.Font = this.Font; b.Click += button_Click; TabButtonPanel.Controls.Add(b); buttonlist.Add(b); selected_index++; tabPanelCtrlList.Add(tpcontrol); TabPanel.Controls.Clear(); TabPanel.Controls.Add(tpcontrol); UpdateButtons(); }
void BackToFront_SelButton() { int i = 0; TabButtonPanel.Controls.Clear(); btstrlist.Clear(); for (i = 0; i < buttonlist.Count; i++) { btstrlist.Add(buttonlist[i].Text); } buttonlist.Clear(); for (int j = 0; j < btstrlist.Count; j++) { if (j == 0) { ButtonX b = new ButtonX(); b.DisplayText = btstrlist[j]; b.Text = btstrlist[j]; b.Size = new Size(130, 23); b.Location = new Point(0, 0); b.ForeColor = Color.White; b.BXBackColor = Color.FromArgb(20, 120, 240); b.MouseHoverColor = Color.FromArgb(20, 120, 240); b.MouseClickColor1 = Color.FromArgb(20, 80, 200); b.ChangeColorMouseHC = false; b.TextLocation_X = 10; b.TextLocation_Y = 9; b.Font = this.Font; b.Click += button_Click; TabButtonPanel.Controls.Add(b); buttonlist.Add(b); selected_index++; } else if (j > 0) { ButtonX b = new ButtonX(); b.DisplayText = btstrlist[j]; b.Text = btstrlist[j]; b.Size = new Size(130, 23); b.ForeColor = Color.White; b.BXBackColor = Color.FromArgb(20, 120, 240); b.MouseHoverColor = Color.FromArgb(20, 120, 240); b.MouseClickColor1 = Color.FromArgb(20, 80, 200); b.ChangeColorMouseHC = false; b.TextLocation_X = 10; b.TextLocation_Y = 9; b.Font = this.Font; b.Click += button_Click; b.Location = new Point(buttonlist[j - 1].Size.Width + buttonlist[j - 1].Location.X, 0); TabButtonPanel.Controls.Add(b); buttonlist.Add(b); selected_index++; } } TabPanel.Controls.Clear(); }