通过反射加载窗体
string path=AssemblyName;
string name=strName;
Form fm=(Form)Assembly.Load(path).CreateInstance(name);
fm.MdiParent=this.ParentForm;
fm.Show();
fm.Dock=DockStyle.Fill;
判断是否为null
string path=AssemblyName;
string name=strName;
Form fm=(Form)Assembly.Load(path).CreateInstance(name);
fm.MdiParent=this.ParentForm;
fm.Show();
fm.Dock=DockStyle.Fill;
判断是否为null
判断myForm是否为null
检查某个程序集里面是否有某个类型不好检查么?有了类型不就能实例化了么? private bool CheckForm(string formTypeFullName,Assembly assembly) {
Type type = assembly.GetType(formTypeFullName);
return type != null;
}