1222 lines
35 KiB
C#

using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Design;
using System.Windows.Forms;
namespace DevComponents.DotNetBar.Charts.Style
{
/// <summary>
/// Represents a SeriesLabelVisualStyle.
/// </summary>
[TypeConverter(typeof(VisualStylesConverter))]
public class DataLabelVisualStyle : BaseVisualStyle
{
#region Private variables
private ConnectorLineVisualStyle _ConnectorLineStyle;
private Tbool _CenterLabel = Tbool.NotSet;
private Tbool _DrawConnector = Tbool.NotSet;
private Tbool _DrawPointMarker = Tbool.NotSet;
private RotateDegrees _RotateDegrees = RotateDegrees.NotSet;
private Background _Background;
private Color _BorderColor = Color.Empty;
private LinePattern _BorderPattern = LinePattern.NotSet;
private int _BorderThickness = -1;
private Padding _Padding;
private Font _Font;
private Color _TextColor = Color.Empty;
private LineAlignment _TextAlignment = LineAlignment.NotSet;
private Background _HighlightBackground;
private Color _HighlightBorderColor = Color.Empty;
private LinePattern _HighlightBorderPattern = LinePattern.NotSet;
private Color _HighlightTextColor = Color.Empty;
private int _MaxTextLineCount = -1;
private int _MaxTextWidth = -1;
private string _TextFormat;
private DropShadowVisualStyle _DropShadow;
#endregion
#region Public properties
#region Background
/// <summary>
/// Gets or sets the style background.
/// </summary>
[Description("Indicates the style background")]
public Background Background
{
get
{
if (_Background == null)
{
_Background = Background.Empty;
UpdateChangeHandler(null, _Background);
}
return (_Background);
}
set
{
if (_Background != value)
{
UpdateChangeHandler(_Background, value);
_Background = value;
OnPropertyChangedEx("Background", VisualChangeType.Render);
}
}
}
/// <summary>
/// Gets whether property should be serialized.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
private bool ShouldSerializeBackground()
{
return (_Background != null && _Background.IsEmpty == false);
}
/// <summary>
/// Resets property to its default value.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
private void ResetBackground()
{
Background = null;
}
#endregion
#region BorderColor
/// <summary>
/// Gets or sets the style border color.
/// </summary>
[Description("Indicates the style Border Color")]
public Color BorderColor
{
get { return (_BorderColor); }
set
{
if (value != _BorderColor)
{
_BorderColor = value;
OnPropertyChangedEx("BorderColor", VisualChangeType.Render);
}
}
}
/// <summary>
/// Gets whether property should be serialized.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
private bool ShouldSerializeBorderColor()
{
return (_BorderColor.IsEmpty == false);
}
/// <summary>
/// Resets property to its default value.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
private void ResetBorderColor()
{
_BorderColor = Color.Empty;
}
#endregion
#region BorderPattern
/// <summary>
/// Gets or sets the style border pattern (Solid, Dash, ...)
/// </summary>
[DefaultValue(LinePattern.NotSet)]
[Description("Indicates the style border pattern (Solid, Dash, ...)")]
public LinePattern BorderPattern
{
get { return (_BorderPattern); }
set
{
if (value != _BorderPattern)
{
_BorderPattern = value;
OnPropertyChangedEx("BorderPattern", VisualChangeType.Render);
}
}
}
#endregion
#region BorderThickness
/// <summary>
/// Gets or sets the style border thickness.
/// </summary>
[Description("Indicates the style border thickness")]
[DefaultValue(-1)]
public int BorderThickness
{
get { return (_BorderThickness); }
set
{
if (value != _BorderThickness)
{
_BorderThickness = value;
OnPropertyChangedEx("BorderThickness", VisualChangeType.Layout);
}
}
}
#endregion
#region DropShadow
/// <summary>
/// Gets or sets the visual style for the DropShadow.
/// </summary>
[Category("Style")]
[Description("Indicates the visual style for the DropShadow.")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public DropShadowVisualStyle DropShadow
{
get
{
if (_DropShadow == null)
{
_DropShadow = new DropShadowVisualStyle();
UpdateChangeHandler(null, _DropShadow);
}
return (_DropShadow);
}
set
{
if (_DropShadow != value)
{
DropShadowVisualStyle oldValue = _DropShadow;
_DropShadow = value;
OnStyleChanged("DropShadow", oldValue, value);
if (oldValue != null)
oldValue.Dispose();
}
}
}
#endregion
#region Font
/// <summary>
/// Gets or sets the style Font
/// </summary>
[DefaultValue(null)]
[Description("Indicates the style Font")]
public Font Font
{
get { return (_Font); }
set
{
if (_Font != value)
{
_Font = value;
OnPropertyChangedEx("Font", VisualChangeType.Layout);
}
}
}
#endregion
#region TextColor
/// <summary>
/// Gets or sets the Text color
/// </summary>
[Description("Indicates the Text color")]
public Color TextColor
{
get { return (_TextColor); }
set
{
if (_TextColor != value)
{
_TextColor = value;
OnPropertyChangedEx("TextColor", VisualChangeType.Render);
}
}
}
/// <summary>
/// Gets whether property should be serialized.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
private bool ShouldSerializeTextColor()
{
return (_TextColor.IsEmpty == false);
}
/// <summary>
/// Resets property to its default value.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
private void ResetTextColor()
{
_TextColor = Color.Empty;
}
#endregion
#region CenterLabel
///<summary>
/// Gets or sets whether the label is centered on top of the data point.
///</summary>
[DefaultValue(Tbool.NotSet), Category("DataLabel")]
[Description("Indicates whether the label is centered on top of the data point.")]
public Tbool CenterLabel
{
get { return (_CenterLabel); }
set
{
if (value != _CenterLabel)
{
_CenterLabel = value;
OnPropertyChangedEx("CenterLabel", Style.VisualChangeType.Layout);
}
}
}
#endregion
#region ConnectorStyle
/// <summary>
/// Gets or sets the visual style for the line Connector.
/// </summary>
[Category("Style")]
[Description("Indicates the visual style for the line Connector.")]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
[NotifyParentProperty(true)]
public ConnectorLineVisualStyle ConnectorLineStyle
{
get
{
if (_ConnectorLineStyle == null)
{
_ConnectorLineStyle = new ConnectorLineVisualStyle();
UpdateChangeHandler(null, _ConnectorLineStyle);
}
return (_ConnectorLineStyle);
}
set
{
if (_ConnectorLineStyle != value)
{
ConnectorLineVisualStyle oldValue = _ConnectorLineStyle;
_ConnectorLineStyle = value;
OnStyleChanged("ConnectorLineStyle", oldValue, value);
if (oldValue != null)
oldValue.Dispose();
}
}
}
#endregion
#region DrawConnector
///<summary>
/// Gets or sets whether a connecting line is drawn to the data point.
///</summary>
[DefaultValue(Tbool.NotSet), Category("DataLabel")]
[Description("Indicates whether a connecting line is drawn to the data point.")]
public Tbool DrawConnector
{
get { return (_DrawConnector); }
set
{
if (value != _DrawConnector)
{
_DrawConnector = value;
OnPropertyChangedEx("DrawConnector", Style.VisualChangeType.Render);
}
}
}
#endregion
#region DrawPointMarker
///<summary>
/// Gets or sets whether the associated Point Marker is drawn for the data point.
///</summary>
[DefaultValue(Tbool.NotSet), Category("DataLabel")]
[Description("Indicates whether the associated Point Marker is drawn for the data point.")]
public Tbool DrawPointMarker
{
get { return (_DrawPointMarker); }
set
{
if (value != _DrawPointMarker)
{
_DrawPointMarker = value;
OnPropertyChangedEx("DrawPointMarker", Style.VisualChangeType.Render);
}
}
}
#endregion
#region HighlightBackground
/// <summary>
/// Gets or sets the Highlight style background.
/// </summary>
[Description("Indicates the Highlight style background")]
public Background HighlightBackground
{
get
{
if (_HighlightBackground == null)
{
_HighlightBackground = Background.Empty;
UpdateChangeHandler(null, _HighlightBackground);
}
return (_HighlightBackground);
}
set
{
if (_HighlightBackground != value)
{
UpdateChangeHandler(_HighlightBackground, value);
_HighlightBackground = value;
OnPropertyChangedEx("HighlightBackground", VisualChangeType.Render);
}
}
}
/// <summary>
/// Gets whether property should be serialized.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
private bool ShouldSerializeHighlightBackground()
{
return (_HighlightBackground != null && _HighlightBackground.IsEmpty == false);
}
/// <summary>
/// Resets property to its default value.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
private void ResetHighlightBackground()
{
HighlightBackground = null;
}
#endregion
#region HighlightBorderColor
/// <summary>
/// Gets or sets the Highlight style border color.
/// </summary>
[Description("Indicates the Highlight style Border Color")]
public Color HighlightBorderColor
{
get { return (_HighlightBorderColor); }
set
{
if (value != _HighlightBorderColor)
{
_HighlightBorderColor = value;
OnPropertyChangedEx("HighlightBorderColor", VisualChangeType.Render);
}
}
}
/// <summary>
/// Gets whether property should be serialized.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
private bool ShouldSerializeHighlightBorderColor()
{
return (_HighlightBorderColor.IsEmpty == false);
}
/// <summary>
/// Resets property to its default value.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
private void ResetHighlightBorderColor()
{
_HighlightBorderColor = Color.Empty;
}
#endregion
#region HighlightBorderPattern
/// <summary>
/// Gets or sets the Highlight style border pattern (Solid, Dash, ...)
/// </summary>
[DefaultValue(LinePattern.NotSet)]
[Description("Indicates the Highlight style border pattern (Solid, Dash, ...)")]
public LinePattern HighlightBorderPattern
{
get { return (_HighlightBorderPattern); }
set
{
if (value != _HighlightBorderPattern)
{
_HighlightBorderPattern = value;
OnPropertyChangedEx("HighlightBorderPattern", VisualChangeType.Render);
}
}
}
#endregion
#region HighlightTextColor
/// <summary>
/// Gets or sets the Highlight Text color
/// </summary>
[Description("Indicates the Highlight Text color")]
public Color HighlightTextColor
{
get { return (_HighlightTextColor); }
set
{
if (value != _HighlightTextColor)
{
_HighlightTextColor = value;
OnPropertyChangedEx("HighlightTextColor", VisualChangeType.Render);
}
}
}
/// <summary>
/// Gets whether property should be serialized.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
private bool ShouldSerializeHighlightTextColor()
{
return (_HighlightTextColor.IsEmpty == false);
}
/// <summary>
/// Resets property to its default value.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
private void ResetHighlightTextColor()
{
_HighlightTextColor = Color.Empty;
}
#endregion
#region MaxTextLineCount
/// <summary>
/// Gets or sets the maximum number of Label Text lines.
/// </summary>
[DefaultValue(-1), Category("Appearance")]
[Description("Indicates the maximum number of Label Text lines.")]
public int MaxTextLineCount
{
get { return (_MaxTextLineCount); }
set
{
if (value != _MaxTextLineCount)
{
_MaxTextLineCount = value;
OnPropertyChangedEx("MaxTextLineCount", VisualChangeType.Layout);
}
}
}
#endregion
#region MaxTextWidth
/// <summary>
/// Gets or sets the maximum width of the label text.
/// </summary>
[DefaultValue(-1), Category("Appearance")]
[Description("Indicates the maximum width of the label text.")]
public int MaxTextWidth
{
get { return (_MaxTextWidth); }
set
{
if (value != _MaxTextWidth)
{
_MaxTextWidth = value;
OnPropertyChangedEx("MaxTextWidth", VisualChangeType.Layout);
}
}
}
#endregion
#region Padding
/// <summary>
/// Gets or sets spacing between the content and edges of the element.
/// </summary>
[Description("Indicates the spacing between the content and edges of the element")]
public Padding Padding
{
get
{
if (_Padding == null)
{
_Padding = Padding.Empty;
UpdateChangeHandler(null, _Padding);
}
return (_Padding);
}
set
{
if (_Padding != value)
{
UpdateChangeHandler(_Padding, value);
_Padding = value;
OnPropertyChangedEx("Padding", VisualChangeType.Layout);
}
}
}
/// <summary>
/// Gets whether property should be serialized.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
private bool ShouldSerializePadding()
{
return (_Padding != null && _Padding.IsEmpty == false);
}
/// <summary>
/// Resets property to its default value.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
private void ResetPadding()
{
Padding = null;
}
#endregion
#region RotateDegrees
/// <summary>
/// Gets or sets the label display rotation.
/// </summary>
[DefaultValue(RotateDegrees.NotSet), Category("Appearance")]
[Description("Indicates the label display rotation.")]
public RotateDegrees RotateDegrees
{
get { return (_RotateDegrees); }
set
{
if (value != _RotateDegrees)
{
_RotateDegrees = value;
OnPropertyChangedEx("RotateDegrees", VisualChangeType.Layout);
}
}
}
#endregion
#region TextAlignment
/// <summary>
/// Gets or sets the alignment of the text
/// </summary>
[DefaultValue(LineAlignment.NotSet), Category("Appearance")]
[Description("Indicates the alignment of the text.")]
public LineAlignment TextAlignment
{
get { return (_TextAlignment); }
set
{
if (value != _TextAlignment)
{
_TextAlignment = value;
OnPropertyChangedEx("TextAlignment", VisualChangeType.Render);
}
}
}
#endregion
#region TextFormat
// "{S}\\n{X:yyyy} ({Y:##,##0})"
// "{Y:C}"
// "X", "Y", "Y0", "Yn"
// "S" (name)
/// <summary>
/// Gets or sets the Text Format specifier
/// </summary>
[DefaultValue(null)]
[Description("Indicates the Text Format specifier")]
public string TextFormat
{
get { return (_TextFormat); }
set
{
if (_TextFormat != value)
{
_TextFormat = value;
OnPropertyChangedEx("TextFormat", VisualChangeType.Render);
}
}
}
#endregion
#region IsEmpty
/// <summary>
/// Gets whether the style is logically Empty.
/// </summary>
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Description("Gets whether the style is logically Empty.")]
public override bool IsEmpty
{
get
{
return ((_Background == null || _Background.IsEmpty == true) &&
(_BorderColor.IsEmpty == true) &&
(_BorderPattern == LinePattern.NotSet) &&
(_BorderThickness < 0) &&
(_CenterLabel == Tbool.NotSet) &&
(_ConnectorLineStyle != null && _ConnectorLineStyle.IsEmpty == true) &&
(_DrawConnector == Tbool.NotSet) &&
(_DrawPointMarker == Tbool.NotSet) &&
(_DropShadow == null || _DropShadow.IsEmpty) &&
(_HighlightBackground == null || _HighlightBackground.IsEmpty == true) &&
(_HighlightBorderColor.IsEmpty == true) &&
(_HighlightBorderPattern == LinePattern.NotSet) &&
(_HighlightTextColor.IsEmpty == true) &&
(_MaxTextLineCount == -1) &&
(_MaxTextWidth == -1) &&
(_Padding == null || _Padding.IsEmpty == true) &&
(_RotateDegrees == RotateDegrees.NotSet) &&
(_TextAlignment == LineAlignment.NotSet) &&
(_TextColor.IsEmpty == true) &&
(string.IsNullOrEmpty(_TextFormat) == true) &&
(base.IsEmpty == true));
}
}
#endregion
#endregion
#region Internal properties
#region HasBorder
internal bool HasBorder
{
get { return (BorderPattern != LinePattern.None &&
BorderColor.IsEmpty == false && BorderThickness > 0); }
}
#endregion
#region HasHighlightBorder
internal bool HasHighlightBorder
{
get
{
return (HighlightBorderPattern != LinePattern.None &&
HighlightBorderColor.IsEmpty == false && BorderThickness > 0);
}
}
#endregion
#endregion
#region GetStringFormatFlags
internal void GetStringFormatFlags(StringFormat sf)
{
sf.LineAlignment = StringAlignment.Center;
switch (TextAlignment)
{
case LineAlignment.Far:
sf.Alignment = StringAlignment.Far;
break;
case LineAlignment.Center:
sf.Alignment = StringAlignment.Center;
break;
default:
sf.Alignment = StringAlignment.Near;
break;
}
}
#endregion
#region ApplyStyle
/// <summary>
/// Applies the style to instance of this style.
/// </summary>
/// <param name="style">Style to apply.</param>
public void ApplyStyle(DataLabelVisualStyle style)
{
if (style != null)
{
base.ApplyStyle(style);
if (style._Background != null && style._Background.IsEmpty == false)
Background = style.Background.Copy();
if (style.BorderColor.IsEmpty == false)
BorderColor = style.BorderColor;
if (style._BorderPattern != LinePattern.NotSet)
BorderPattern = style.BorderPattern;
if (style.BorderThickness >= 0)
BorderThickness = style.BorderThickness;
if (style.ConnectorLineStyle.IsEmpty == false)
ConnectorLineStyle.ApplyStyle(style.ConnectorLineStyle);
if (style.CenterLabel != Tbool.NotSet)
CenterLabel = style.CenterLabel;
if (style.DrawConnector != Tbool.NotSet)
DrawConnector = style.DrawConnector;
if (style.DrawPointMarker != Tbool.NotSet)
DrawPointMarker = style.DrawPointMarker;
if (style._DropShadow != null && style.DropShadow.IsEmpty == false)
DropShadow.ApplyStyle(style.DropShadow);
if (style.Font != null)
Font = (Font)style.Font.Clone();
if (style._HighlightBackground != null && style._HighlightBackground.IsEmpty == false)
HighlightBackground = style.HighlightBackground.Copy();
if (style.HighlightBorderColor.IsEmpty == false)
HighlightBorderColor = style.HighlightBorderColor;
if (style.HighlightBorderPattern != LinePattern.NotSet)
HighlightBorderPattern = style.HighlightBorderPattern;
if (style.HighlightTextColor.IsEmpty == false)
HighlightTextColor = style.HighlightTextColor;
if (style.MaxTextLineCount >= 0)
MaxTextLineCount = style.MaxTextLineCount;
if (style.MaxTextWidth >= 0)
MaxTextWidth = style.MaxTextWidth;
if (style._Padding != null && style._Padding.IsEmpty == false)
Padding = style.Padding.Copy();
if (style.RotateDegrees != RotateDegrees.NotSet)
RotateDegrees = style.RotateDegrees;
if (style.TextAlignment != LineAlignment.NotSet)
TextAlignment = style.TextAlignment;
if (style.TextColor.IsEmpty == false)
TextColor = style.TextColor;
if (string.IsNullOrEmpty(style.TextFormat) == false)
TextFormat = style.TextFormat;
}
}
#endregion
#region ApplyDefaults
public override void ApplyDefaults()
{
if (Font == null)
Font = SystemFonts.DefaultFont;
if (TextColor.IsEmpty == true)
TextColor = Color.Black;
if (BorderColor.IsEmpty == true)
BorderColor = Color.Black;
if (BorderPattern == LinePattern.NotSet)
BorderPattern = LinePattern.Solid;
if (BorderThickness < 0)
BorderThickness = 1;
if (Background.IsEmpty)
Background = new Background(Color.WhiteSmoke);
if (DrawConnector == Tbool.NotSet)
DrawConnector = Tbool.True;
if (DrawPointMarker == Tbool.NotSet)
DrawPointMarker = Tbool.True;
if (HighlightBackground.IsEmpty)
HighlightBackground = new Background(Color.Yellow);
if (HighlightTextColor.IsEmpty == true)
HighlightTextColor = Color.Black;
if (HighlightBorderColor.IsEmpty == true)
HighlightBorderColor = Color.Black;
if (HighlightBorderPattern == LinePattern.NotSet)
HighlightBorderPattern = LinePattern.Solid;
ConnectorLineStyle.ApplyDefaults();
base.ApplyDefaults();
}
#endregion
#region Copy
/// <summary>
/// Returns the copy of the style.
/// </summary>
/// <returns>Copy of the style.</returns>
public new DataLabelVisualStyle Copy()
{
DataLabelVisualStyle style = new DataLabelVisualStyle();
CopyTo(style);
return (style);
}
#endregion
#region CopyTo
/// <summary>
/// Returns the copy of the style.
/// </summary>
/// <returns>Copy of the style.</returns>
public void CopyTo(DataLabelVisualStyle style)
{
base.CopyTo(style);
style.Background = (_Background == null) ? null : _Background.Copy();
style.BorderColor = _BorderColor;
style.BorderPattern = _BorderPattern;
style.BorderThickness = _BorderThickness;
style.ConnectorLineStyle = (_ConnectorLineStyle == null) ? null : _ConnectorLineStyle.Copy();
style.CenterLabel = _CenterLabel;
style.DrawConnector = _DrawConnector;
style.DrawPointMarker = _DrawPointMarker;
style.DropShadow = (_DropShadow != null) ? DropShadow.Copy() : null;
style.Font = (_Font == null) ? null : (Font)_Font.Clone();
style.HighlightBackground = (_HighlightBackground == null) ? null : _HighlightBackground.Copy();
style.HighlightBorderColor = _HighlightBorderColor;
style.HighlightBorderPattern = _HighlightBorderPattern;
style.HighlightTextColor = _HighlightTextColor;
style.MaxTextLineCount = _MaxTextLineCount;
style.MaxTextWidth = _MaxTextWidth;
style.Padding = (_Padding == null) ? null : _Padding.Copy();
style.RotateDegrees = _RotateDegrees;
style.TextAlignment = _TextAlignment;
style.TextColor = _TextColor;
style.TextFormat = _TextFormat;
}
#endregion
#region GetSerialData
internal override SerialElementCollection GetSerialData(string serialName)
{
SerialElementCollection sec = new SerialElementCollection();
if (serialName != null)
{
if (serialName.Equals("") == true)
serialName = "DataLabelVisualStyle";
sec.AddStartElement(serialName);
}
if (_Background != null && _Background.IsEmpty == false)
sec.AddElement(_Background.GetSerialData("Background"));
sec.AddValue("BorderColor", BorderColor, Color.Empty);
sec.AddValue("BorderPattern", BorderPattern, LinePattern.NotSet);
sec.AddValue("BorderThickness", BorderThickness, -1);
if (_ConnectorLineStyle != null && _ConnectorLineStyle.IsEmpty == false)
sec.AddElement(_ConnectorLineStyle.GetSerialData("ConnectorLineStyle"));
sec.AddValue("CenterLabel", CenterLabel, Tbool.NotSet);
sec.AddValue("DrawConnector", DrawConnector, Tbool.NotSet);
sec.AddValue("DrawPointMarker", DrawPointMarker, Tbool.NotSet);
if (_DropShadow != null && _DropShadow.IsEmpty == false)
sec.AddElement(_DropShadow.GetSerialData("DropShadow"));
if (_Font != null)
sec.AddValue("Font", XmlSerializableFont.ConvertToString(Font));
if (_HighlightBackground != null && _HighlightBackground.IsEmpty == false)
sec.AddElement(_HighlightBackground.GetSerialData("HighlightBackground"));
sec.AddValue("HighlightBorderColor", HighlightBorderColor, Color.Empty);
sec.AddValue("HighlightBorderPattern", HighlightBorderPattern, LinePattern.NotSet);
sec.AddValue("HighlightTextColor", HighlightTextColor, Color.Empty);
sec.AddValue("MaxTextLineCount", MaxTextLineCount, -1);
sec.AddValue("MaxTextWidth", MaxTextWidth, -1);
if (_Padding != null && _Padding.IsEmpty == false)
sec.AddElement(_Padding.GetSerialData("Padding"));
sec.AddValue("RotateDegrees", RotateDegrees, RotateDegrees.NotSet);
sec.AddValue("TextAlignment", TextAlignment, LineAlignment.NotSet);
sec.AddValue("TextColor", TextColor, Color.Empty);
sec.AddValue("TextFormat", TextFormat, null);
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 "BorderColor":
BorderColor = se.GetValueColor();
break;
case "BorderPattern":
BorderPattern = (LinePattern)se.GetValueEnum(typeof(LinePattern));
break;
case "BorderThickness":
BorderThickness = int.Parse(se.StringValue);
break;
case "CenterLabel":
CenterLabel = (Tbool)se.GetValueEnum(typeof(Tbool));
break;
case "DrawConnector":
DrawConnector = (Tbool)se.GetValueEnum(typeof(Tbool));
break;
case "DrawPointMarker":
DrawPointMarker = (Tbool)se.GetValueEnum(typeof(Tbool));
break;
case "Font":
Font = XmlSerializableFont.ConvertFromString(se.StringValue);
break;
case "HighlightBorderColor":
HighlightBorderColor = se.GetValueColor();
break;
case "HighlightBorderPattern":
HighlightBorderPattern = (LinePattern)se.GetValueEnum(typeof(LinePattern));
break;
case "HighlightTextColor":
HighlightTextColor = se.GetValueColor();
break;
case "MaxTextLineCount":
MaxTextLineCount = int.Parse(se.StringValue);
break;
case "MaxTextWidth":
MaxTextWidth = int.Parse(se.StringValue);
break;
case "RotateDegrees":
RotateDegrees = (RotateDegrees)se.GetValueEnum(typeof(RotateDegrees));
break;
case "TextAlignment":
TextAlignment = (LineAlignment)se.GetValueEnum(typeof(LineAlignment));
break;
case "TextColor":
TextColor = se.GetValueColor();
break;
case "TextFormat":
TextFormat = se.StringValue;
break;
default:
base.ProcessValue(se);
break;
}
}
#endregion
#region ProcessCollection
internal override void ProcessCollection(SerialElement se)
{
SerialElementCollection sec = se.Sec;
switch (se.Name)
{
case "Background":
sec.PutSerialData(Background);
break;
case "ConnectorLineStyle":
sec.PutSerialData(ConnectorLineStyle);
break;
case "DropShadow":
sec.PutSerialData(DropShadow);
break;
case "HighlightBackground":
sec.PutSerialData(HighlightBackground);
break;
case "Padding":
sec.PutSerialData(Padding);
break;
default:
base.ProcessCollection(se);
break;
}
}
#endregion
#endregion
#region IDisposable
/// <summary>
/// Dispose
/// </summary>
public override void Dispose()
{
Background = null;
DropShadow = null;
ConnectorLineStyle = null;
HighlightBackground = null;
Padding = null;
base.Dispose();
}
#endregion
}
}