internal void ChildFormClosed (Form form)
{
FormWindowState closed_form_windowstate = form.WindowState;
form.Visible = false;
Controls.Remove (form);
if (Controls.Count == 0) {
((MdiWindowManager) form.window_manager).RaiseDeactivate ();
} else if (closed_form_windowstate == FormWindowState.Maximized) {
Form current = (Form) Controls [0];
current.WindowState = FormWindowState.Maximized;
ActivateChild(current);
}
if (Controls.Count == 0) {
XplatUI.RequestNCRecalc (Parent.Handle);
ParentForm.PerformLayout ();
// If we closed the last child, unmerge the menus.
// If it's not the last child, the menu will be unmerged
// when another child takes focus.
MenuStrip parent_menu = form.MdiParent.MainMenuStrip;
if (parent_menu != null)
if (parent_menu.IsCurrentlyMerged)
ToolStripManager.RevertMerge (parent_menu);
}
SizeScrollBars ();
SetParentText (false);
form.Dispose();
}