标签:
/// <summary> /// 功能:MDI程序中设置主窗体大小为显示器工作区大小 /// </summary> /// <param name="MainForm">主窗体实例</param> public static void SetMainFormSize(Form MainForm) { MainForm.Location = new Point(0, 0); MainForm.Width = Screen.PrimaryScreen.WorkingArea.Width; MainForm.Height = Screen.PrimaryScreen.WorkingArea.Height; }
*****************************************************
/// <summary> /// 功能:MDI程序中设置子窗体大小为父窗体工作区大小 /// </summary> /// <param name="MdiForm">子窗体实例</param> public static void SetMdiChildSize(Form MdiForm) { MdiForm.Location = new Point(0, 0); MdiForm.Width = MdiForm.Parent.ClientSize.Width; MdiForm.Height = MdiForm.Parent.ClientSize.Height; }
*****************************************************
/// <summary> /// 功能:关闭所有打开的MDI子窗体 /// </summary> /// <param name="MainForm">参数:父窗体</param> public static void CloseAllMdiForms(Form MainForm) { if (MainForm.MdiChildren.Length <= 0) { return; } else { foreach (Form SubForm in MainForm.MdiChildren) { SubForm.Close(); } } }
*****************************************************
/// <summary> /// 功能:检测Mdi子窗体状态变化,当子窗体最小化或最大化时恢复默认状态 /// </summary> /// <param name="MdiForm">子窗体实例</param> public static void SetMdiFormState(Form MdiForm) { if (MdiForm == null) { return; } else if ((MdiForm.WindowState == FormWindowState.Minimized) || (MdiForm.WindowState==FormWindowState.Maximized)) { MdiForm.WindowState = FormWindowState.Normal; } }
标签:
原文地址:http://www.cnblogs.com/handsome1008/p/4660029.html