DotNet 4.8.1 build of DotNetBar
This commit is contained in:
@@ -0,0 +1,847 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
///<summary>
|
||||
/// ChartLegendVisualStyles
|
||||
///</summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class ChartLegendItemVisualStyles : VisualStyles<ChartLegendItemVisualStyle>
|
||||
{
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public ChartLegendItemVisualStyles Copy()
|
||||
{
|
||||
ChartLegendItemVisualStyles styles = new ChartLegendItemVisualStyles();
|
||||
|
||||
for (int i = 0; i < Styles.Length; i++)
|
||||
{
|
||||
ChartLegendItemVisualStyle vstyle = Styles[i];
|
||||
|
||||
if (vstyle != null)
|
||||
styles.Styles[i] = vstyle.Copy();
|
||||
}
|
||||
|
||||
return (styles);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the visual style of a Legend item element.
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class ChartLegendItemVisualStyle : BaseVisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private Background _Background;
|
||||
private Color _TextColor = Color.Empty;
|
||||
private Font _Font;
|
||||
|
||||
private Tbool _AllowWrap = Tbool.NotSet;
|
||||
private Alignment _Alignment = Alignment.NotSet;
|
||||
private int _MaxLineCount;
|
||||
|
||||
private Background _CheckBoxBackground;
|
||||
private Color _CheckBoxBorderColor = Color.Empty;
|
||||
private Color _CheckBoxCheckColor = Color.Empty;
|
||||
|
||||
private PointMarkerVisualStyle _MarkerVisualStyle;
|
||||
|
||||
private Background _DisabledMarkerBackground;
|
||||
private Color _DisabledTextColor = Color.Empty;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region Alignment
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the alignment of the text
|
||||
/// </summary>
|
||||
[DefaultValue(Alignment.NotSet), Category("Appearance")]
|
||||
[Description("Indicates the alignment of the text.")]
|
||||
public Alignment Alignment
|
||||
{
|
||||
get { return (_Alignment); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Alignment != value)
|
||||
{
|
||||
_Alignment = value;
|
||||
|
||||
OnPropertyChangedEx("Alignment", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region AllowWrap
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether text wrapping is permitted
|
||||
/// </summary>
|
||||
[DefaultValue(Tbool.NotSet), Category("Appearance")]
|
||||
[Description("Indicates whether text wrapping is permitted.")]
|
||||
public Tbool AllowWrap
|
||||
{
|
||||
get { return (_AllowWrap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_AllowWrap != value)
|
||||
{
|
||||
_AllowWrap = value;
|
||||
|
||||
OnPropertyChangedEx("AllowWrap", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#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 CheckBoxBackground
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the CheckBox background.
|
||||
/// </summary>
|
||||
[Description("Indicates the CheckBox background")]
|
||||
public Background CheckBoxBackground
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_CheckBoxBackground == null)
|
||||
{
|
||||
_CheckBoxBackground = Background.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _CheckBoxBackground);
|
||||
}
|
||||
|
||||
return (_CheckBoxBackground);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_CheckBoxBackground != value)
|
||||
{
|
||||
UpdateChangeHandler(_CheckBoxBackground, value);
|
||||
|
||||
_CheckBoxBackground = value;
|
||||
|
||||
OnPropertyChangedEx("CheckBoxBackground", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeCheckBoxBackground()
|
||||
{
|
||||
return (_CheckBoxBackground != null && _CheckBoxBackground.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetCheckBoxBackground()
|
||||
{
|
||||
CheckBoxBackground = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CheckBoxBorderColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the CheckBox border color.
|
||||
/// </summary>
|
||||
[Description("Indicates the CheckBox border color")]
|
||||
public Color CheckBoxBorderColor
|
||||
{
|
||||
get { return (_CheckBoxBorderColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_CheckBoxBorderColor != value)
|
||||
{
|
||||
_CheckBoxBorderColor = value;
|
||||
|
||||
OnPropertyChangedEx("CheckBoxBorderColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeCheckBoxBorderColor()
|
||||
{
|
||||
return (_CheckBoxBorderColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetCheckBoxBorderColor()
|
||||
{
|
||||
CheckBoxBorderColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CheckBoxCheckColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the CheckBox check color.
|
||||
/// </summary>
|
||||
[Description("Indicates the CheckBox check color")]
|
||||
public Color CheckBoxCheckColor
|
||||
{
|
||||
get { return (_CheckBoxCheckColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_CheckBoxCheckColor != value)
|
||||
{
|
||||
_CheckBoxCheckColor = value;
|
||||
|
||||
OnPropertyChangedEx("CheckBoxCheckColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeCheckBoxCheckColor()
|
||||
{
|
||||
return (_CheckBoxCheckColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetCheckBoxCheckColor()
|
||||
{
|
||||
CheckBoxCheckColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region DisabledMarkerBackground
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Disabled Marker Background style.
|
||||
/// </summary>
|
||||
[Description("Indicates the Disabled Marker Background style")]
|
||||
public Background DisabledMarkerBackground
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_DisabledMarkerBackground == null)
|
||||
{
|
||||
_DisabledMarkerBackground = Background.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _DisabledMarkerBackground);
|
||||
}
|
||||
|
||||
return (_DisabledMarkerBackground);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_DisabledMarkerBackground != value)
|
||||
{
|
||||
UpdateChangeHandler(_DisabledMarkerBackground, value);
|
||||
|
||||
_DisabledMarkerBackground = value;
|
||||
|
||||
OnPropertyChangedEx("DisabledMarkerBackground", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeDisabledMarkerBackground()
|
||||
{
|
||||
return (_DisabledMarkerBackground != null && _DisabledMarkerBackground.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetDisabledMarkerBackground()
|
||||
{
|
||||
DisabledMarkerBackground = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region DisabledTextColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Disabled TextColor
|
||||
/// </summary>
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates whether the items in the Legend are equally spaced.")]
|
||||
public Color DisabledTextColor
|
||||
{
|
||||
get { return (_DisabledTextColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _DisabledTextColor)
|
||||
{
|
||||
_DisabledTextColor = value;
|
||||
|
||||
OnPropertyChangedEx("DisabledTextColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeDisabledTextColor()
|
||||
{
|
||||
return (_DisabledTextColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetDisabledTextColor()
|
||||
{
|
||||
DisabledTextColor = Color.Empty;
|
||||
}
|
||||
|
||||
#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 MarkerVisualStyle
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual styles for the Legend Marker.
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates the visual styles for the PointMarker.")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public PointMarkerVisualStyle MarkerVisualStyle
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_MarkerVisualStyle == null)
|
||||
{
|
||||
_MarkerVisualStyle = new PointMarkerVisualStyle();
|
||||
|
||||
UpdateChangeHandler(null, _MarkerVisualStyle);
|
||||
}
|
||||
|
||||
return (_MarkerVisualStyle);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_MarkerVisualStyle != value)
|
||||
{
|
||||
PointMarkerVisualStyle oldValue = _MarkerVisualStyle;
|
||||
|
||||
_MarkerVisualStyle = value;
|
||||
|
||||
OnStyleChanged("MarkerVisualStyle", oldValue, value);
|
||||
|
||||
if (oldValue != null)
|
||||
oldValue.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region MaxLineCount
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum number of lines for the item text.
|
||||
/// </summary>
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates the maximum number of lines for the item text.")]
|
||||
[DefaultValue(0)]
|
||||
public int MaxLineCount
|
||||
{
|
||||
get { return (_MaxLineCount); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _MaxLineCount)
|
||||
{
|
||||
_MaxLineCount = value;
|
||||
|
||||
OnPropertyChangedEx("MaxLineCount", 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 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 ((_Alignment == Alignment.NotSet) &&
|
||||
(_AllowWrap == Tbool.NotSet) &&
|
||||
(_Background == null || _Background.IsEmpty == true) &&
|
||||
(_CheckBoxBackground == null || _CheckBoxBackground.IsEmpty == true) &&
|
||||
(_CheckBoxBorderColor.IsEmpty == true) &&
|
||||
(_CheckBoxCheckColor.IsEmpty == true) &&
|
||||
(_DisabledMarkerBackground == null || _DisabledMarkerBackground.IsEmpty == true) &&
|
||||
(_DisabledTextColor.IsEmpty == true) &&
|
||||
(_Font == null) &&
|
||||
(_MarkerVisualStyle == null || _MarkerVisualStyle.IsEmpty) &&
|
||||
(_MaxLineCount == 0) &&
|
||||
(_TextColor.IsEmpty == true) &&
|
||||
(base.IsEmpty == true));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetStringFormatFlags
|
||||
|
||||
internal void GetStringFormatFlags(StringFormat sf)
|
||||
{
|
||||
if (_AllowWrap == Tbool.False || _MaxLineCount <= 1)
|
||||
sf.FormatFlags |= StringFormatFlags.NoWrap;
|
||||
|
||||
sf.Trimming = StringTrimming.EllipsisCharacter;
|
||||
|
||||
switch (Alignment)
|
||||
{
|
||||
case Alignment.TopCenter:
|
||||
sf.LineAlignment = StringAlignment.Near;
|
||||
sf.Alignment = StringAlignment.Center;
|
||||
break;
|
||||
|
||||
case Alignment.TopRight:
|
||||
sf.LineAlignment = StringAlignment.Near;
|
||||
sf.Alignment = StringAlignment.Far;
|
||||
break;
|
||||
|
||||
case Alignment.NotSet:
|
||||
case Alignment.MiddleLeft:
|
||||
sf.LineAlignment = StringAlignment.Center;
|
||||
sf.Alignment = StringAlignment.Near;
|
||||
break;
|
||||
|
||||
case Alignment.MiddleCenter:
|
||||
sf.LineAlignment = StringAlignment.Center;
|
||||
sf.Alignment = StringAlignment.Center;
|
||||
break;
|
||||
|
||||
case Alignment.MiddleRight:
|
||||
sf.LineAlignment = StringAlignment.Center;
|
||||
sf.Alignment = StringAlignment.Far;
|
||||
break;
|
||||
|
||||
case Alignment.BottomLeft:
|
||||
sf.LineAlignment = StringAlignment.Far;
|
||||
sf.Alignment = StringAlignment.Near;
|
||||
break;
|
||||
|
||||
case Alignment.BottomCenter:
|
||||
sf.LineAlignment = StringAlignment.Far;
|
||||
sf.Alignment = StringAlignment.Center;
|
||||
break;
|
||||
|
||||
case Alignment.BottomRight:
|
||||
sf.LineAlignment = StringAlignment.Far;
|
||||
sf.Alignment = StringAlignment.Far;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(ChartLegendItemVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style.Alignment != Alignment.NotSet)
|
||||
Alignment = style.Alignment;
|
||||
|
||||
if (style.AllowWrap != Tbool.NotSet)
|
||||
AllowWrap = style.AllowWrap;
|
||||
|
||||
if (style._Background != null && style._Background.IsEmpty == false)
|
||||
Background = style._Background.Copy();
|
||||
|
||||
if (style._CheckBoxBackground != null && style._CheckBoxBackground.IsEmpty == false)
|
||||
CheckBoxBackground = style._CheckBoxBackground.Copy();
|
||||
|
||||
if (style._CheckBoxBorderColor.IsEmpty == false)
|
||||
CheckBoxBorderColor = style._CheckBoxBorderColor;
|
||||
|
||||
if (style._CheckBoxCheckColor.IsEmpty == false)
|
||||
CheckBoxCheckColor = style._CheckBoxCheckColor;
|
||||
|
||||
if (style._DisabledMarkerBackground != null && style._DisabledMarkerBackground.IsEmpty == false)
|
||||
DisabledMarkerBackground = style.DisabledMarkerBackground.Copy();
|
||||
|
||||
if (style.DisabledTextColor.IsEmpty == false)
|
||||
DisabledTextColor = style.DisabledTextColor;
|
||||
|
||||
if (style.Font != null)
|
||||
Font = style.Font;
|
||||
|
||||
if (style._MarkerVisualStyle != null && style.MarkerVisualStyle.IsEmpty == false)
|
||||
MarkerVisualStyle.ApplyStyle(style.MarkerVisualStyle);
|
||||
|
||||
if (style.MaxLineCount != 0)
|
||||
MaxLineCount = style.MaxLineCount;
|
||||
|
||||
if (style._TextColor.IsEmpty == false)
|
||||
TextColor = style._TextColor;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new ChartLegendItemVisualStyle Copy()
|
||||
{
|
||||
ChartLegendItemVisualStyle style = new ChartLegendItemVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(ChartLegendItemVisualStyle style)
|
||||
{
|
||||
base.CopyTo(style);
|
||||
|
||||
style.Alignment = _Alignment;
|
||||
style.AllowWrap = _AllowWrap;
|
||||
|
||||
style.Background = (_Background != null) ? _Background.Copy() : null;
|
||||
|
||||
style.CheckBoxBackground = (_CheckBoxBackground != null) ? _CheckBoxBackground.Copy() : null;
|
||||
style.CheckBoxBorderColor = _CheckBoxBorderColor;
|
||||
style.CheckBoxCheckColor = _CheckBoxCheckColor;
|
||||
|
||||
style.DisabledMarkerBackground = (_DisabledMarkerBackground != null ? _DisabledMarkerBackground.Copy() : null);
|
||||
style.DisabledTextColor = _DisabledTextColor;
|
||||
|
||||
style.Font = (_Font != null) ? (Font)_Font.Clone() : null;
|
||||
style.MarkerVisualStyle = (_MarkerVisualStyle != null) ? _MarkerVisualStyle.Copy() : null;
|
||||
|
||||
style.MaxLineCount = _MaxLineCount;
|
||||
style.TextColor = _TextColor;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSerialData
|
||||
|
||||
internal override SerialElementCollection GetSerialData(string serialName)
|
||||
{
|
||||
SerialElementCollection sec = new SerialElementCollection();
|
||||
|
||||
if (serialName != null)
|
||||
{
|
||||
if (serialName.Equals("") == true)
|
||||
serialName = "ChartLegendItemVisualStyle";
|
||||
|
||||
sec.AddStartElement(serialName);
|
||||
}
|
||||
|
||||
sec.AddValue("Alignment", _Alignment, Alignment.NotSet);
|
||||
sec.AddValue("AllowWrap", _AllowWrap, Tbool.NotSet);
|
||||
|
||||
if (_Background != null && _Background.IsEmpty == false)
|
||||
sec.AddElement(_Background.GetSerialData("Background"));
|
||||
|
||||
if (_CheckBoxBackground != null && _CheckBoxBackground.IsEmpty == false)
|
||||
sec.AddElement(_CheckBoxBackground.GetSerialData("CheckBoxBackground"));
|
||||
|
||||
sec.AddValue("CheckBoxBorderColor", _CheckBoxBorderColor, Color.Empty);
|
||||
sec.AddValue("CheckBoxCheckColor", _CheckBoxCheckColor, Color.Empty);
|
||||
|
||||
if (_Font != null)
|
||||
sec.AddValue("Font", XmlSerializableFont.ConvertToString(Font));
|
||||
|
||||
if (_MarkerVisualStyle != null && _MarkerVisualStyle.IsEmpty == false)
|
||||
sec.AddElement(_MarkerVisualStyle.GetSerialData("MarkerVisualStyle"));
|
||||
|
||||
sec.AddValue("MaxLineCount", _MaxLineCount, 0);
|
||||
sec.AddValue("TextColor", _TextColor, Color.Empty);
|
||||
|
||||
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 "Alignment":
|
||||
Alignment = (Alignment)se.GetValueEnum(typeof(Alignment));
|
||||
break;
|
||||
|
||||
case "AllowWrap":
|
||||
AllowWrap = (Tbool)se.GetValueEnum(typeof(Tbool));
|
||||
break;
|
||||
|
||||
case "CheckBoxBorderColor":
|
||||
CheckBoxBorderColor = se.GetValueColor();
|
||||
break;
|
||||
|
||||
case "CheckBoxCheckColor":
|
||||
CheckBoxCheckColor = se.GetValueColor();
|
||||
break;
|
||||
|
||||
case "Font":
|
||||
Font = XmlSerializableFont.ConvertFromString(se.StringValue);
|
||||
break;
|
||||
|
||||
case "MaxLineCount":
|
||||
MaxLineCount = int.Parse(se.StringValue);
|
||||
break;
|
||||
|
||||
case "TextColor":
|
||||
TextColor = se.GetValueColor();
|
||||
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 "CheckBoxBackground":
|
||||
sec.PutSerialData(CheckBoxBackground);
|
||||
break;
|
||||
|
||||
case "MarkerVisualStyle":
|
||||
sec.PutSerialData(MarkerVisualStyle);
|
||||
break;
|
||||
|
||||
default:
|
||||
base.ProcessCollection(se);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Background = null;
|
||||
CheckBoxBackground = null;
|
||||
MarkerVisualStyle = null;
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user