Type[] types = assembly.GetTypes(); foreach( Type t in types ) { if( t is Form ) //you can create a instance to do something,like : { Form frm = Activator.CreateInstance( t ); frm.Show(); } }
FindwindowEx可以拿到子窗体
同意Axlong(爱心龙龙) 用反射
一楼的应该错了吧 t is Form????System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();Type[] types = assembly.GetTypes(); foreach (Type t in types) { if (t.IsAssignableFrom(typeof(System.Windows.Forms.Form))) //******************* //you can create a instance to do something,like : { System.Windows.Forms.Form frm = Activator.CreateInstance(t); frm.Show(); } }
Type[] types = assembly.GetTypes();
foreach( Type t in types )
{
if( t is Form )
//you can create a instance to do something,like :
{
Form frm = Activator.CreateInstance( t );
frm.Show();
}
}
用反射
foreach (Type t in types)
{
if (t.IsAssignableFrom(typeof(System.Windows.Forms.Form))) //*******************
//you can create a instance to do something,like :
{
System.Windows.Forms.Form frm = Activator.CreateInstance(t);
frm.Show();
}
}
你能查查资料再说话吗?