public BaseForm() { for (int i = 0; i < fnArgs.Length; i++) { fnArgs[i] = new FormArg(); } InitializeComponent(); this.AutoScaleMode = AutoScaleMode.None; }
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == null) { throw new ArgumentNullException("destinationType"); } if (value is FormArg) { if (destinationType == typeof(string)) { FormArg size = (FormArg)value; if (culture == null) { culture = CultureInfo.CurrentCulture; } string separator = culture.TextInfo.ListSeparator + " "; TypeConverter converter = TypeDescriptor.GetConverter(typeof(string)); string array = converter.ConvertToString(context, culture, size.Context); return(string.Join(separator, array)); } if (destinationType == typeof(InstanceDescriptor)) { FormArg arg = (FormArg)value; ConstructorInfo constructor = typeof(FormArg).GetConstructor(new Type[] { typeof(string), }); if (constructor != null) { return(new InstanceDescriptor(constructor, new object[] { arg.Context, })); } } } return(base.ConvertTo(context, culture, value, destinationType)); }