private void TabControlParent_MouseClick(object sender, MouseEventArgs e) { lastClickedPoint = e.Location; if (e.Button == MouseButtons.Right) { for (int ix = 0; ix < TabControlParent.TabCount; ++ix) { if (TabControlParent.GetTabRect(ix).Contains(e.Location)) { TabContextMenuStrip.Show(this, e.Location); TabControlParent.SelectedTab = TabControlParent.TabPages[ix]; TabViewChange(TabControlParent.TabPages[ix] as Classes.LogTabPage); } } } else if (e.Button == MouseButtons.Left) { for (int ix = 0; ix < TabControlParent.TabCount; ++ix) { if (TabControlParent.GetTabRect(ix).Contains(e.Location)) { if (TabControlParent.TabPages[ix].Tag.ToString() == "Folder") { //SelectedFolder = TabControlParent.TabPages[ix] as Classes.LogTabPage; // TabViewChange(TabControlParent.TabPages[ix] as Classes.LogTabPage); } } } } }
private void SubTab_Click(object source, MouseEventArgs e) { lastClickedPoint = e.Location; if (e.Button == MouseButtons.Right) { //TabControl SubTabControl = GetTabControlByFolder(); try { TabControl subTabControl = (GetSelectedFolder().Controls.Find("SubTabControl", true).FirstOrDefault()) as TabControl; for (int ix = 0; ix < subTabControl.TabCount; ++ix) { if (subTabControl.GetTabRect(ix).Contains(e.Location)) { TabContextMenuStrip.Show(this, e.Location); lastClickedPoint = e.Location; subTabControl.SelectedTab = subTabControl.TabPages[ix]; TabViewChange(subTabControl.TabPages[ix] as Classes.LogTabPage); } } } catch (NullReferenceException ex) { Console.WriteLine(ex.Message); } } }