You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
1.9 KiB
C#

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