日期:2014-05-18 浏览次数:20874 次
private void btnAdd_Click(object sender, EventArgs e) { TabPage Page = new TabPage(); Page.Name = "Page" + index.ToString(); Page.Text = "tabPage" + index.ToString(); Page.TabIndex = index; this.tabControl1.Controls.Add(Page); #region 三种设置某个选项卡为当前选项卡的方法 //this.tabControl1.SelectedIndex = index; this.tabControl1.SelectedTab = Page; //this.tabControl1.SelectTab("Page" + index.ToString()); #endregion index++; } #region 两种删除某个选项卡的方法 this.tabControl1.Controls.RemoveAt(this.tabControl1.SelectedIndex); //this.tabControl1.Controls.Remove(this.tabControl1.TabPages[this.tabControl1.TabPages.Count-1]); #endregion