private void tabSet_SelectedIndexChanged(object sender, EventArgs e) { // Hide windows from old tab. m_tabCurrent.HideWindows(); // Show windws for new tab. m_tabCurrent = m_tabs[tabSet.SelectedIndex]; m_tabCurrent.ShowWindows(); }
private void ProjectMainForm_FormClosing(object sender, FormClosingEventArgs e) { // The close event has already been sent to the frontmost child window, // which hides itself and cancels the Close. // This causes 2 problems: // If we show a dialog (e.g., to ask if we need to save changes), then the // front child window will disappear when the dialog is shown. // The main window Close is cancelled. // To fix this, show all current windows in the tab... m_tabCurrent.ShowWindows(); // ... and un-cancel the Close so that the main form can close. e.Cancel = false; // Make sure the document is closed properly. if (m_doc != null && !m_doc.Close()) { e.Cancel = true; return; } }