using System; using System.ComponentModel; using System.Globalization; using GeoSigma.SigmaDrawerStyle; using GeoSigma.SigmaDrawerStyle.Converter; namespace GeoSigma.SigmaDrawerElement.Converter { /// /// 字体 Converter /// public class WellFontExConverter : BaseTypeConverter { /// public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { return destinationType == typeof(string) || base.CanConvertTo(context, destinationType); } /// public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(string) && value is WellFontEx font) { return $"{font.FontName}"; } return base.ConvertTo(context, culture, value, destinationType); } /// public override bool GetPropertiesSupported(ITypeDescriptorContext context) { return true; } /// public override PropertyDescriptorCollection GetProperties( ITypeDescriptorContext context, object value, Attribute[] attributes) { return TypeDescriptor.GetProperties(typeof(WellFontEx), attributes); } } }