反射通过控件名返回控件对象
通过控件名获取控件对象
--this为控件所在的界面
object o = this.GetType().GetField(controlName, System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.IgnoreCase).GetValue(this); var cmb = ((ComboBox)o);
动态创建对象
Assembly assembly = Assembly.GetExecutingAssembly();
Form frm = assembly.CreateInstance("命名空间." + formName) as Form;