|
发表于 2020-6-22 17:30:02
|
显示全部楼层
Type type = Type.GetType("窗体的完整类名(MyNameSpace.MyForm)");
// 创建窗体实例
Object obj = type.InvokeMember(null,
BindingFlags.Public | BindingFlags.NonPublic |
BindingFlags.Instance | BindingFlags.CreateInstance, null, null, null);
// 显示窗体
type.InvokeMember("Show",System.Reflection.BindingFlags.InvokeMethod,null,obj,null); |
|