C# TabControl 隱藏(hide)/顯示(show) TabPage的方法
C# TabControl 隱藏(hide)/顯示(show) TabPage的方法
資料來源:http://wp.mlab.tw/?p=1802
範例程式:在FORM上新增一個tabControl1預設就會有tabPage1和tabPage2,之後再tabPage1上放上button1並且tabPage2放上button2
code:
private void button2_Click(object sender, EventArgs e) { this.tabPage2.Parent = null; // hide this.tabPage1.Parent = this.tabControl1; //show } private void button1_Click(object sender, EventArgs e) { this.tabPage1.Parent = null; // hide this.tabPage2.Parent = this.tabControl1; //show }