將TabPage顯示
將TabPage隱形
程式碼如下
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication2 { public partial class Form1 : Form { TabPage mMoneyPage; public Form1() { InitializeComponent(); //get Tabpage ref for (int i = 0; i < tabControl1.TabPages.Count; i++) { if (tabControl1.TabPages[i].Name.Equals("money")) { mMoneyPage = tabControl1.TabPages[i]; } } } private void checkBox1_CheckedChanged(object sender, EventArgs e) { if (mMoneyPage != null) { if (((CheckBox)sender).Checked) { mMoneyPage.Parent = tabControl1; } else { mMoneyPage.Parent = null; } } } } }
沒有留言:
張貼留言