Remove tab on middle mouse click

This commit is contained in:
Jaex 2015-08-31 16:59:33 +03:00
parent 50dd65c610
commit eef6a0cd21

View file

@ -61,6 +61,34 @@ public TabManager(TabControl tabControl)
{
tc = tabControl;
Tabs = new List<TabInfo>();
tc.MouseClick += tc_MouseClick;
}
private void tc_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Middle)
{
for (int i = 0; i < tc.TabCount; ++i)
{
if (tc.GetTabRect(i).Contains(e.Location))
{
TabPage tabPage = tc.TabPages[i];
if (tabPage != null)
{
TabInfo tabInfo = tabPage.Tag as TabInfo;
if (tabInfo != null)
{
tc.TabPages.Remove(tabPage);
Tabs.Remove(tabInfo);
}
}
return;
}
}
}
}
public void AddMessage(string channel, string message)