C# WeifenLuo.WinFormsUI.Docking.dll 应用之问题集 反射动态调用winform窗体

反射通过命名空间.窗体名称,调用窗体

 public void OpenChildForm(string formName)
        {
            Type t = Type.GetType(formName);
            Assembly asm = Assembly.GetExecutingAssembly();
            DockContent frm = asm.CreateInstance(formName) as DockContent;
            if (frm != null)
            {
                frm.Show(this.dockPanelMain);
            }
        }

 重复打开窗体监测

 public bool CheckFormIsOpen(string formname)
        {
            bool remark = false;
            for (int a = 0; a < base.MdiChildren.Length; a++)
            {
                if (formname.Equals(base.MdiChildren[a].GetType().Namespace + "." + base.MdiChildren[a].GetType().Name))
                {
                    base.MdiChildren[a].Activate();
                    remark = true;
                }
            }
            return remark;
        }

 

C# WeifenLuo.WinFormsUI.Docking.dll 应用之问题集 反射动态调用winform窗体

上一篇:C# WeifenLuo.WinFormsUI.Docking.dll 应用之问题集 子窗体访问父窗体方法


下一篇:工作系统切换从windows为linux