public class FormsCollection : CollectionBase走訪的方式
{
public Form Add(Form FormObject)
{
base.List.Add(FormObject);
return (FormObject);
}
public void Remove(Form FormObject)
{
base.List.Remove(FormObject);
}
}
Type form = typeof(Form);
foreach (Type item in Assembly.GetExecutingAssembly().GetTypes())
{
//if (item.BaseType == typeof(Form))
if (item.Name.StartsWith("Frm_"))
{
Form f = (Form)Activator.CreateInstance(item);
forms.Add(f);
}
}
資料來源:微軟知識庫