TabPage是一个Form,里面有Timer在运行;TabControl怎么彻底关闭这个TabPage,然不是Remove,因为Remove后Timer还是在运行?
foreach (TabPage page in TabControl1.TabPages)//遍历得到和关闭的选项卡一样的Text
{
if (page.Text == name)
{
pageindex = page.TabIndex;
TabControl1.TabPages.Remove(page);
foreach (Control t in page.Controls)
{
if (t is System.Windows.Forms.Form)
(t as Form).Close();
}
page.Dispose();
TabControl1.SelectedTabPageIndex = pageindex - 1;
return;
}
do{shutdown}就可以了😃
先关闭Timer再remove。。。