using System.ComponentModel; using System.Drawing; namespace DevComponents.DotNetBar.Charts.Style { /// /// Represents the visual style of a Legend element. /// [TypeConverter(typeof(VisualStylesConverter))] public class SliceCenterLineVisualStyle : ChartLineVisualStyle { #region Private variables private int _InnerExtent; private int _OuterExtent; #endregion #region Public properties #region InnerExtent /// /// Gets or sets the distance (in pixels) to which the center line /// is extended prior to the slice inner radius. /// [Description("Indicates the distance (in pixels) to which the center line is extended prior to the slice inner radius.")] [DefaultValue(0)] public int InnerExtent { get { return (_InnerExtent); } set { if (_InnerExtent != value) { _InnerExtent = value; OnPropertyChangedEx("InnerExtent", VisualChangeType.Render); } } } #endregion #region OuterExtent /// /// Gets or sets the distance (in pixels) to which the center line /// is extended past to the slice Outer radius. /// [Description("Indicates the distance (in pixels) to which the center line is extended past the slice Outer radius.")] [DefaultValue(0)] public int OuterExtent { get { return (_OuterExtent); } set { if (_OuterExtent != value) { _OuterExtent = value; OnPropertyChangedEx("OuterExtent", VisualChangeType.Render); } } } #endregion #region IsEmpty /// /// Gets whether the style is logically Empty. /// [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [Description("Gets whether the style is logically Empty.")] public override bool IsEmpty { get { return ((_InnerExtent == 0) && (_OuterExtent == 0) && (base.IsEmpty == true)); } } #endregion #endregion #region ApplyStyle /// /// Applies the style to the instance of this style. /// /// Style to apply. public void ApplyStyle(SliceCenterLineVisualStyle style) { if (style != null) { base.ApplyStyle(style); if (style.InnerExtent != 0) InnerExtent = style.InnerExtent; if (style.OuterExtent != 0) OuterExtent = style.OuterExtent; } } #endregion #region ApplyDefaults public override void ApplyDefaults() { base.ApplyDefaults(); } #endregion #region Copy /// /// Returns the copy of the style. /// /// Copy of the style. public new SliceCenterLineVisualStyle Copy() { SliceCenterLineVisualStyle style = new SliceCenterLineVisualStyle(); CopyTo(style); return (style); } #endregion #region CopyTo /// /// Returns the copy of the style. /// /// Copy of the style. public void CopyTo(SliceCenterLineVisualStyle style) { base.CopyTo(style); style.InnerExtent = _InnerExtent; style.OuterExtent = _OuterExtent; } #endregion #region GetSerialData internal override SerialElementCollection GetSerialData(string serialName) { SerialElementCollection sec = new SerialElementCollection(); if (serialName != null) { if (serialName.Equals("") == true) serialName = "SliceCenterLineVisualStyle"; sec.AddStartElement(serialName); } sec.AddValue("InnerExtent", InnerExtent, 0); sec.AddValue("OuterExtent", OuterExtent, 0); sec.AddElement(base.GetSerialData(null)); if (serialName != null) sec.AddEndElement(serialName); return (sec); } #endregion #region PutSerialData #region ProcessValue internal override void ProcessValue(SerialElement se) { switch (se.Name) { case "InnerExtent": InnerExtent = int.Parse(se.StringValue); break; case "OuterExtent": OuterExtent = int.Parse(se.StringValue); break; default: base.ProcessValue(se); break; } } #endregion #region ProcessCollection internal override void ProcessCollection(SerialElement se) { SerialElementCollection sec = se.Sec; switch (se.Name) { default: base.ProcessCollection(se); break; } } #endregion #endregion } }