private void CreateNewModViewerTab(ModViewerTabControl mvtc)
        {
            selectedModViewer = mvtc;
            TabPage newPage = new TabPage(mvtc.Content.GetName());

            newPage.Controls.Add(mvtc);
            newPage.Name = mvtc.Content.GetName();
            ModViewerTabs.TabPages.Add(newPage);
            ModViewerTabs.SelectTab(newPage);
        }
        private void ModViewerTabs_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Middle)
            {
                // Thanks, Samuel from StackOverflow for this 12 year old solution
                TabPage tab = ModViewerTabs.TabPages.Cast <TabPage>().Where((t, i) => ModViewerTabs.GetTabRect(i).Contains(e.Location)).First();
                // Selecting a tab fires an event handler that'll update SelectedModViewer, so we can just use that variable
                ModViewerTabs.SelectTab(tab);

                CloseMod();
            }
        }
 private void CreateNewModViewerTab(string folder, bool isVanilla, bool newMod)
 {
     try
     {
         selectedModViewer = new ModViewerTabControl(folder, isVanilla, newMod);
         selectedModViewer.MarkDirtyEventHandler += MarkTabDirty;
         TabPage newPage = new TabPage(selectedModViewer.Content.GetName());
         newPage.Controls.Add(selectedModViewer);
         newPage.Name = selectedModViewer.Content.GetName();
         ModViewerTabs.TabPages.Add(newPage);
         ModViewerTabs.SelectTab(newPage);
     }
     catch
     {
     }
 }