public void DelTab(tab t) { if (this.TabBox.Controls.Count == 1) { MessageBox.Show("您要留一个呀", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { this.TabBox.Controls.Remove(t); tabList.Remove(t); this.ContentBox.Controls.Remove(t.TabPanel); panelList.Remove(t.TabPanel); foreachTabList(); } }
private void Tab_MouseDown(object sender, MouseEventArgs e) { foreach (Control c in this.TabBox.Controls) { if (c is tab) { tab c_tab = (tab)c; c_tab.TabIsFocus = false; } } this_tab = (tab)sender; this_tab.TabIsFocus = true; TabIsDown = true; unlack = true; startPoint = e.Location; }
private void TabIsFocus_Changed(object sender) { tab this_tab = (tab)sender; if (this_tab.TabIsFocus) { this_tab.Height += 5; this_tab.Top -= 5; this_tab.TabBackColor = m_form.formGetFocus;; foreachPanelList(); } else { this_tab.Height -= 5; this_tab.Top = 6; this_tab.TabBackColor = m_form.formTitleBackColor; } }
public void AddTab() { tab tab = new tab(this); TabPanelContent panel = new TabPanelContent(); tab.TabPanel = panel; tab.id = tabList.Last <tab>().id + 1; tab.TabTitle = "tab" + (tab.id + 1); if (m_form != null) { tab.BackColor = m_form.formTitleBackColor; } tab.MouseDown += new MouseEventHandler(this.Tab_MouseDown); tab.MouseMove += new MouseEventHandler(this.Tab_MouseMove); tab.MouseUp += new MouseEventHandler(this.Tab_MouseUp); tab.MouseLeave += new EventHandler(this.Tab_MouseUp); tab.TabIsFocusChangeds += new tab.ChangedEventHandler(this.TabIsFocus_Changed); tabList.Add(tab); panelList.Add(panel); foreachTabList(); }
private void createTabList() { if (DockTabListNumber > 0) { tab[] t = new tab[DockTabListNumber]; TabPanelContent[] p = new TabPanelContent[DockTabListNumber]; Color[] color = { Color.FromArgb(197, 213, 203), Color.FromArgb(159, 168, 163), Color.FromArgb(227, 224, 207), Color.FromArgb(233, 236, 229), Color.FromArgb(176, 171, 194), }; for (int i = 0; i < DockTabListNumber; i++) { t[i] = new tab(this); p[i] = new TabPanelContent(); p[i].BackColor = color[i]; t[i].TabPanel = p[i]; t[i].id = i; t[i].TabTitle = "tab" + (i + 1); t[i].MouseDown += new MouseEventHandler(this.Tab_MouseDown); t[i].MouseMove += new MouseEventHandler(this.Tab_MouseMove); t[i].MouseUp += new MouseEventHandler(this.Tab_MouseUp); t[i].MouseLeave += new EventHandler(this.Tab_MouseUp); t[i].TabIsFocusChangeds += new tab.ChangedEventHandler(this.TabIsFocus_Changed); tabList.Add(t[i]); panelList.Add(p[i]); } } else { tab tab1 = new tab(this); TabPanelContent panel1 = new TabPanelContent(); tab1.id = 0; tab1.TabPanel = panel1; tab1.TabTitle = "tab1"; tab1.MouseDown += new MouseEventHandler(this.Tab_MouseDown); tabList.Add(tab1); panelList.Add(panel1); } }