请问TabControl控件如何做到向MAXHON那样双击两下就关闭
2个回答
展开全部
private void tabControl1_MouseDoubleClick(object sender, MouseEventArgs e)
{
TabControl tabControl1 = (TabControl)sender;
Point pt = new Point(e.X, e.Y);
for (int i = 0; i < tabControl1.TabCount; i++)
{
Rectangle recTab = tabControl1.GetTabRect(i);
if (recTab.Contains(pt))
{
TabPage seltab = this.tabControl1.SelectedTab;
int seltabindex = this.tabControl1.SelectedIndex;
tabControl1.Controls.Remove(seltab);
tabControl1.SelectTab(seltabindex - 1);
return;
}
}
}
{
TabControl tabControl1 = (TabControl)sender;
Point pt = new Point(e.X, e.Y);
for (int i = 0; i < tabControl1.TabCount; i++)
{
Rectangle recTab = tabControl1.GetTabRect(i);
if (recTab.Contains(pt))
{
TabPage seltab = this.tabControl1.SelectedTab;
int seltabindex = this.tabControl1.SelectedIndex;
tabControl1.Controls.Remove(seltab);
tabControl1.SelectTab(seltabindex - 1);
return;
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询