1先说显示项的控制,
第一个是selectedIndex属性这个实用性不是太强,但是如果不涉及到隐藏,删除,增加tabpage的话,也可以用。
第二个是selectedTab=tabPage1,这个属性可以把之前更改的tabpage找回来啦,
别的属性暂时没看。。。
2微软不建议 隐藏或者修改TAB,但是现实中我们有时候也用到,个人暂时感觉好用的如下(只是隐藏,删除其他的用到再研究)
再上个例子和图
private void button1_Click(object sender, EventArgs e) { // TabPage tp = tabControl1.TabPages[0]; //TabPage[] tabpage = new TabPage[9]; if (comboBox1.SelectedIndex == 0) { //tabControl1.TabPages.Remove(tp); this.tabPage2.Parent = null; //this.tabPage2 . Parent = null; //this.tabPage3.Parent = null; //this.tabPage4.Parent = null; //this.tabPage5.Parent = null; //this.tabPage6.Parent = null; } else { //tabControl1.TabPages.Insert(0, tp);//显示(插入) this.tabPage2.Parent = this.tabControl1;//显示 } }