/// <summary> /// 释放TabControl的所有TabPage资源 /// </summary> /// <param name="tabControl">需释放所有TabPage资源的TabControl控件</param> public static void DisposeAllTabPages(this TabControl tabControl) { if (tabControl == null) { return; } foreach (TabPage page in tabControl.TabPages) { tabControl.DisposeTabPage(page); } }
/// <summary> /// 释放TabControl的选中TabPage资源 /// </summary> /// <param name="tabControl">需释放选中TabPage资源的TabControl控件</param> public static void DisposeSelectedTabPage(this TabControl tabControl) { tabControl.DisposeTabPage(tabControl.SelectedTab); }