public void Stop() { foreach (TabPage page in tabPages.TabPages) { foreach (Control control in page.Controls) { IControlPage controlPage = control as IControlPage; if (controlPage != null) { controlPage.Stop(); } } } }
private void tabPages_MouseDown(object sender, MouseEventArgs e) { Rectangle textRect = tabPages.GetTabRect(tabPages.SelectedIndex); Bitmap bmp = global::CmdManager.Properties.Resources.close_16; Rectangle closeArea = new Rectangle(textRect.X + textRect.Width - bmp.Width, (textRect.Height - bmp.Height) / 2, bmp.Width, bmp.Height); if (closeArea.Contains(e.X, e.Y)) { foreach (Control control in tabPages.SelectedTab.Controls) { IControlPage controlPage = control as IControlPage; if (controlPage != null) { controlPage.Stop(); } } tabPages.TabPages.Remove(tabPages.SelectedTab); } }