mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
Remove tab on middle mouse click
This commit is contained in:
parent
50dd65c610
commit
eef6a0cd21
1 changed files with 28 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue