using System; using System.ComponentModel; using System.Globalization; namespace CustomControls.Pattern { /// /// Scripts类型转换 /// public class PatternScriptsTypeConverter : ExpandableObjectConverter { public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(string) && value is XRPatternScripts) { return "(Pattern Scripts)"; } return base.ConvertTo(context, culture, value, destinationType); } } /// /// CodeOptions类型转化 /// public class CodeOptionsTypeConverter : ExpandableObjectConverter { public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(string) && value is CodeOptions) { return "(Options)"; } return base.ConvertTo(context, culture, value, destinationType); } } }