如何将工程中所有的窗体遍历出来

时了很多方法不行,望大家帮忙
---------------------------------------------------------------

System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();

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();
}
}

Published At
Categories with Web编程
Tagged with
comments powered by Disqus