using System.ComponentModel; using System.Drawing; using System.Drawing.Design; using System.Xml.Linq; using System.Xml.Serialization; namespace GeoSigma.SigmaDrawerStyle { /// /// 线型 /// public class WellLineStyle { /// /// xml 字段 /// [Browsable(false)] [XmlAttribute("Color")] public string ColorString { get; set; } /// /// 颜色 /// [XmlIgnore] [Category("属性"), DisplayName("颜色")] [Editor(typeof(PropertyEditorColor), typeof(UITypeEditor))] public Color Color { get => ColorTranslator2.FromHtml(ColorString); set => ColorString = ColorTranslator2.ToHtml(value); } /// /// xml 字段 /// [Browsable(false)] [XmlAttribute("Width")] public string WidthString { get; set; } = string.Empty; /// /// 宽度 /// [XmlIgnore] [Category("属性"), DisplayName("宽度")] public double Width { get { if (double.TryParse(WidthString, out double value)) { return value; } return 0; } set { WidthString = value.ToString(); } } /// /// 线型 /// [Category("属性"), DisplayName("线型")] [ListBoxEditor("LineType")] [Editor(typeof(PropertyEditorListBox), typeof(UITypeEditor))] [XmlAttribute("Style")] public string Style { get; set; } = string.Empty; /// public override string ToString() { return Style; } } }