如何在右键单击时选择或聚焦某个标签页?
答案 0 :(得分:1)
实施MouseDown事件并找出点击了哪个标签:
private void tabControl1_MouseDown(object sender, MouseEventArgs e) {
if (e.Button == MouseButtons.Right) {
for (int tab = 0; tab < tabControl1.TabCount; ++tab) {
if (tabControl1.GetTabRect(tab).Contains(e.Location)) {
tabControl1.SelectedIndex = tab;
break;
}
}
}
}