/// <summary> /// 子画面を非表示にする /// </summary> /// <param name="type">閉じる画面</param> public static void CloseChildForm(Type type) { var form = ChildFormList.Where(x => x.GetType() == type).FirstOrDefault(); if (form != null) { form.Close(); ChildFormList.Remove(form); } }
/// <summary> /// 子画面が開いているか確認 /// </summary> /// <param name="type">調べる画面</param> /// <returns>true : false </returns> public static bool IsOpenChildForm(Type type) { if (ChildFormList.Any(x => x.GetType() == type)) { return(true); } else { return(false); } }
public void subNewMdiChildren(Form childForm, string frmText) { //if (Login._login_menu_opt.ToString() == "S") //싱글창 조건일 경우 //{ // 같은 메뉴가 이미 떠 있으면 띄우지 않는다. foreach (Form ChildFormList in this.MdiChildren) { if (ChildFormList.Name == childForm.Name) { ChildFormList.Activate(); return; } } //} Form newChildFrm = childForm; newChildFrm.Text = childForm.Name + "-" + frmText; newChildFrm.MdiParent = this; newChildFrm.WindowState = FormWindowState.Maximized; //newChildFrm.StartPosition = FormStartPosition.WindowsDefaultLocation; newChildFrm.Show(); }
/// <summary> /// 子画面を開く /// </summary> /// <param name="type">開く画面</param> public static void ShowChildForm(Type type, int?height = null, int?width = null, int?top = null, int?left = null) { if (ChildFormList == null) { ChildFormList = new List <Form>(); } if (!ChildFormList.Any(x => x.GetType() == type)) { var form = (Form)Activator.CreateInstance(type); ChildFormList.Add(form); form.MdiParent = ParentForm; if (height != null) { form.Height = (int)height; } if (width != null) { form.Width = (int)width; } if (top != null) { form.StartPosition = FormStartPosition.Manual; form.Top = (int)top; form.Left = (int)left; } form.Show(); } else { var form = ChildFormList.Where(x => x.GetType() == type).First(); form.Show(); form.Activate(); } }