C # How many WinForm MDI Form Control codes are written,
/// <Summary> /// function: in the MDI program, set the main Form size to the display workspace size. /// </summary> /// <param name = "MainForm"> main Form instance </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> /// function: in the MDI program, set the child form size to the workspace size of the parent form /// </summary> /// <param name = "MdiForm"> child form instance </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> /// function: Disable all opened MDI child forms // </summary> /// <param name = "MainForm"> parameter: parent Form </param> public static void CloseAllMdiForms (Form MainForm) {if (MainForm. mdichil.pdf. length <= 0) {return;} else {foreach (Form SubForm in MainForm. mdichilform) {SubForm. close ();}}}
**************************************** *************
/// <Summary> /// function: checks the status change of the Mdi subform, restore the default state when the sub-form is minimized or maximized /// </summary> /// <param name = "MdiForm"> sub-form instance </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 ;}}