DotNet 4.8.1 build of DotNetBar
This commit is contained in:
@@ -0,0 +1,206 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
///<summary>
|
||||
/// AnnotationVisualStyles
|
||||
///</summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class AnnotationVisualStyles : VisualStyles<AnnotationVisualStyle>
|
||||
{
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public AnnotationVisualStyles Copy()
|
||||
{
|
||||
AnnotationVisualStyles styles = new AnnotationVisualStyles();
|
||||
|
||||
for (int i = 0; i < Styles.Length; i++)
|
||||
{
|
||||
AnnotationVisualStyle vstyle = Styles[i];
|
||||
|
||||
if (vstyle != null)
|
||||
styles.Styles[i] = vstyle.Copy();
|
||||
}
|
||||
|
||||
return (styles);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the visual style of a Legend element.
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class AnnotationVisualStyle : ContainerVisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private AnnotationShape _AnnotationShape = AnnotationShape.Ellipse;
|
||||
private ConnectorShape _ConnectorShape = ConnectorShape.NotSet;
|
||||
|
||||
private Alignment _TextAlignment = Alignment.NotSet;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region AnnotationShape
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the shape of the annotation container.
|
||||
/// </summary>
|
||||
[DefaultValue(AnnotationShape.NotSet), Category("Appearance")]
|
||||
[Description("Indicates the shape of the annotation container.")]
|
||||
public AnnotationShape AnnotationShape
|
||||
{
|
||||
get { return (_AnnotationShape); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_AnnotationShape != value)
|
||||
{
|
||||
_AnnotationShape = value;
|
||||
|
||||
OnPropertyChangedEx("AnnotationShape", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ConnectorShape
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the shape of the annotation connector.
|
||||
/// </summary>
|
||||
[DefaultValue(ConnectorShape.NotSet), Category("Appearance")]
|
||||
[Description("Indicates the shape of the annotation connector.")]
|
||||
public ConnectorShape ConnectorShape
|
||||
{
|
||||
get { return (_ConnectorShape); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ConnectorShape != value)
|
||||
{
|
||||
_ConnectorShape = value;
|
||||
|
||||
OnPropertyChangedEx("ConnectorShape", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TextAlignment
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the alignment of the content within the cell
|
||||
/// </summary>
|
||||
[DefaultValue(Alignment.NotSet), Category("Appearance")]
|
||||
[Description("Indicates the alignment of the content within the cell.")]
|
||||
public Alignment TextAlignment
|
||||
{
|
||||
get { return (_TextAlignment); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_TextAlignment != value)
|
||||
{
|
||||
_TextAlignment = value;
|
||||
|
||||
OnPropertyChangedEx("TextAlignment", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#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 ((_AnnotationShape == AnnotationShape.NotSet) &&
|
||||
(_ConnectorShape == ConnectorShape.NotSet) &&
|
||||
(_TextAlignment == Alignment.NotSet) &&
|
||||
(base.IsEmpty == true));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(AnnotationVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style.AnnotationShape != AnnotationShape.NotSet)
|
||||
_AnnotationShape = style.AnnotationShape;
|
||||
|
||||
if (style.ConnectorShape != ConnectorShape.NotSet)
|
||||
_ConnectorShape = style.ConnectorShape;
|
||||
|
||||
if (style.TextAlignment != Alignment.NotSet)
|
||||
_TextAlignment = style.TextAlignment;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new AnnotationVisualStyle Copy()
|
||||
{
|
||||
AnnotationVisualStyle style = new AnnotationVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(AnnotationVisualStyle style)
|
||||
{
|
||||
base.CopyTo(style);
|
||||
|
||||
style.AnnotationShape = _AnnotationShape;
|
||||
style.ConnectorShape = _ConnectorShape;
|
||||
style.TextAlignment = _TextAlignment;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,213 @@
|
||||
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 AxisStripeVisualStyle.
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class AxisStripeVisualStyle : BaseVisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private Background _Background;
|
||||
|
||||
#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 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) &&
|
||||
(base.IsEmpty == true));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(AxisStripeVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style._Background != null && style._Background.IsEmpty == false)
|
||||
Background = style._Background.Copy();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new AxisStripeVisualStyle Copy()
|
||||
{
|
||||
AxisStripeVisualStyle style = new AxisStripeVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(AxisStripeVisualStyle style)
|
||||
{
|
||||
base.CopyTo(style);
|
||||
|
||||
style.Background = (_Background != null) ? _Background.Copy() : null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSerialData
|
||||
|
||||
internal override SerialElementCollection GetSerialData(string serialName)
|
||||
{
|
||||
SerialElementCollection sec = new SerialElementCollection();
|
||||
|
||||
if (serialName != null)
|
||||
{
|
||||
if (serialName.Equals("") == true)
|
||||
serialName = "AxisStripeVisualStyle";
|
||||
|
||||
sec.AddStartElement(serialName);
|
||||
}
|
||||
|
||||
if (_Background != null && _Background.IsEmpty == false)
|
||||
sec.AddElement(_Background.GetSerialData("Background"));
|
||||
|
||||
sec.AddElement(base.GetSerialData(null));
|
||||
|
||||
if (serialName != null)
|
||||
sec.AddEndElement(serialName);
|
||||
|
||||
return (sec);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PutSerialData
|
||||
|
||||
#region ProcessCollection
|
||||
|
||||
internal override void ProcessCollection(SerialElement se)
|
||||
{
|
||||
SerialElementCollection sec = se.Sec;
|
||||
|
||||
switch (se.Name)
|
||||
{
|
||||
case "Background":
|
||||
sec.PutSerialData(Background);
|
||||
break;
|
||||
|
||||
default:
|
||||
base.ProcessCollection(se);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
Background = null;
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,290 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
///<summary>
|
||||
/// BackColorBlend
|
||||
///</summary>
|
||||
[TypeConverter(typeof(BackColorBlendConvertor))]
|
||||
public class BackColorBlend : INotifyPropertyChanged, IProcessSerialElement
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private Color[] _Colors; // Color values
|
||||
private float[] _Positions; // Gradient color positions
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region Colors
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ColorBlend Color array
|
||||
/// </summary>
|
||||
[Browsable(true), DefaultValue(null)]
|
||||
[Description("Indicates the ColorBlend Color array")]
|
||||
[TypeConverter(typeof(ArrayConverter))]
|
||||
public Color[] Colors
|
||||
{
|
||||
get { return (_Colors); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != null && value.Length == 0)
|
||||
value = null;
|
||||
|
||||
_Colors = value;
|
||||
|
||||
OnPropertyChangedEx("Colors");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Positions
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ColorBlend Color Positions
|
||||
/// </summary>
|
||||
[Browsable(true), DefaultValue(null)]
|
||||
[Description("Indicates the ColorBlend Color Positions")]
|
||||
[TypeConverter(typeof(ArrayConverter))]
|
||||
public float[] Positions
|
||||
{
|
||||
get { return (_Positions); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != null && value.Length == 0)
|
||||
value = null;
|
||||
|
||||
_Positions = value;
|
||||
|
||||
OnPropertyChangedEx("Positions");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsEmpty
|
||||
|
||||
/// <summary>
|
||||
/// IsEmpty
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsEmpty
|
||||
{
|
||||
get { return (_Colors == null || _Colors.Length == 1 && _Colors[0].IsEmpty); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Creates an exact copy of the BackColorBlend.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the BackColorBlend.</returns>
|
||||
public BackColorBlend Copy()
|
||||
{
|
||||
BackColorBlend copy = new BackColorBlend();
|
||||
|
||||
if (_Colors != null)
|
||||
{
|
||||
copy.Colors = new Color[_Colors.Length];
|
||||
|
||||
_Colors.CopyTo(copy.Colors, 0);
|
||||
}
|
||||
|
||||
if (_Positions != null)
|
||||
{
|
||||
copy.Positions = new float[_Positions.Length];
|
||||
|
||||
_Positions.CopyTo(copy.Positions, 0);
|
||||
}
|
||||
|
||||
return (copy);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSerialData
|
||||
|
||||
internal SerialElementCollection GetSerialData()
|
||||
{
|
||||
SerialElementCollection sec = new SerialElementCollection();
|
||||
|
||||
sec.AddStartElement("BackColorBlend");
|
||||
|
||||
if (_Colors != null && _Colors.Length > 0)
|
||||
{
|
||||
sec.AddStartElement("Colors count=\"" + _Colors.Length + "\"");
|
||||
|
||||
foreach (Color color in _Colors)
|
||||
sec.AddValue("Color", color);
|
||||
|
||||
sec.AddEndElement("Colors");
|
||||
}
|
||||
|
||||
if (_Positions != null && _Positions.Length > 0)
|
||||
{
|
||||
sec.AddStartElement("Positions count=\"" + _Positions.Length + "\"");
|
||||
|
||||
foreach (float pos in _Positions)
|
||||
sec.AddDataValue("Position", pos);
|
||||
|
||||
sec.AddEndElement("Positions");
|
||||
}
|
||||
|
||||
sec.AddEndElement("BackColorBlend");
|
||||
|
||||
return (sec);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PutSerialData
|
||||
|
||||
#region ProcessValue
|
||||
|
||||
void IProcessSerialElement.ProcessValue(SerialElement se)
|
||||
{
|
||||
switch (se.Name)
|
||||
{
|
||||
case "Color":
|
||||
_Colors[se.ValueIndex] = se.ColorValue;
|
||||
break;
|
||||
|
||||
case "Position":
|
||||
_Positions[se.ValueIndex] = (float)se.DataValue;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Exception("Unknown Serial Value (" + se.Name + ")");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ProcessCollection
|
||||
|
||||
void IProcessSerialElement.ProcessCollection(SerialElement se)
|
||||
{
|
||||
int count = se.ArrayCount;
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
switch (se.Name)
|
||||
{
|
||||
case "Colors":
|
||||
_Colors = new Color[count];
|
||||
break;
|
||||
|
||||
case "Positions":
|
||||
_Positions = new float[count];
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Exception("Unknown Serial Collection (" + se.Name + ")");
|
||||
}
|
||||
|
||||
se.Sec.PutSerialData(this);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region INotifyPropertyChanged Members
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when property value has changed.
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Raises the PropertyChanged event.
|
||||
/// </summary>
|
||||
/// <param name="e">Event arguments</param>
|
||||
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
|
||||
{
|
||||
PropertyChangedEventHandler eh = PropertyChanged;
|
||||
|
||||
if (eh != null)
|
||||
eh(this, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises the PropertyChanged event.
|
||||
/// </summary>
|
||||
/// <param name="s">Event arguments</param>
|
||||
protected virtual void OnPropertyChangedEx(string s)
|
||||
{
|
||||
PropertyChangedEventHandler eh = PropertyChanged;
|
||||
|
||||
if (eh != null)
|
||||
{
|
||||
VisualPropertyChangedEventArgs e =
|
||||
new VisualPropertyChangedEventArgs(s);
|
||||
|
||||
eh(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region BackColorBlendConvertor
|
||||
|
||||
/// <summary>
|
||||
/// BackColorBlendConvertor
|
||||
/// </summary>
|
||||
public class BackColorBlendConvertor : ExpandableObjectConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// ConvertTo
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="culture"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="destinationType"></param>
|
||||
/// <returns></returns>
|
||||
public override object ConvertTo(
|
||||
ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
|
||||
{
|
||||
if (destinationType == typeof(string))
|
||||
{
|
||||
BackColorBlend cb = value as BackColorBlend;
|
||||
|
||||
if (cb != null)
|
||||
{
|
||||
ColorConverter cvt = new ColorConverter();
|
||||
|
||||
if (cb.Colors != null)
|
||||
{
|
||||
if (cb.Colors[0] != Color.Empty)
|
||||
return (cvt.ConvertToString(cb.Colors[0]));
|
||||
|
||||
if (cb.Colors.Length > 1 && cb.Colors[1] != Color.Empty)
|
||||
return (cvt.ConvertToString(cb.Colors[1]));
|
||||
}
|
||||
}
|
||||
|
||||
return (String.Empty);
|
||||
}
|
||||
|
||||
return (base.ConvertTo(context, culture, value, destinationType));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,622 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the base visual style.
|
||||
/// </summary>
|
||||
[ToolboxItem(false), DesignTimeVisible(false)]
|
||||
public class BaseVisualStyle : INotifyPropertyChanged, IDisposable, IProcessSerialElement
|
||||
{
|
||||
#region Static data
|
||||
|
||||
static private List<BaseVisualStyle> _StyleList;
|
||||
private static StyleUpdateMode _StyleUpdateMode = StyleUpdateMode.Full;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private variables
|
||||
|
||||
private StyleType _StyleType;
|
||||
private BaseVisualStyle _Parent;
|
||||
|
||||
private ushort _StyleUpdateCount;
|
||||
|
||||
private string _Class = "";
|
||||
private object _Tag;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region Class
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the class style belongs to.
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public string Class
|
||||
{
|
||||
get { return (_Class); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Class != value)
|
||||
{
|
||||
_Class = value;
|
||||
|
||||
OnPropertyChangedEx("Class", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#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 virtual bool IsEmpty
|
||||
{
|
||||
get { return (_Tag == null); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Tag
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the user defined reference Tag.
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("User defined reference Tag.")]
|
||||
public object Tag
|
||||
{
|
||||
get { return (_Tag); }
|
||||
set { _Tag = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal properties
|
||||
|
||||
#region StyleType
|
||||
|
||||
internal StyleType StyleType
|
||||
{
|
||||
get { return (_StyleType); }
|
||||
set { _StyleType = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StyleUpdateCount
|
||||
|
||||
internal ushort StyleUpdateCount
|
||||
{
|
||||
get { return (_StyleUpdateCount); }
|
||||
set { _StyleUpdateCount = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StyleUpdateMode
|
||||
|
||||
internal StyleUpdateMode StyleUpdateMode
|
||||
{
|
||||
get { return (_StyleUpdateMode); }
|
||||
set { _StyleUpdateMode = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Parent
|
||||
|
||||
internal BaseVisualStyle Parent
|
||||
{
|
||||
get { return (_Parent); }
|
||||
set { _Parent = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StyleList
|
||||
|
||||
internal List<BaseVisualStyle> StyleList
|
||||
{
|
||||
get { return (_StyleList); }
|
||||
set { _StyleList = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(BaseVisualStyle style)
|
||||
{
|
||||
if (StyleList != null)
|
||||
StyleList.Add(style ?? this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetApplyStyleTypes
|
||||
|
||||
internal StyleType[] GetApplyStyleTypes(StyleType e)
|
||||
{
|
||||
StyleType[] css = null;
|
||||
|
||||
switch (e)
|
||||
{
|
||||
case StyleType.Default:
|
||||
css = new StyleType[] { StyleType.Default};
|
||||
break;
|
||||
|
||||
case StyleType.MouseOver:
|
||||
css = new StyleType[] { StyleType.Default, e };
|
||||
break;
|
||||
|
||||
case StyleType.Selected:
|
||||
css = new StyleType[] { StyleType.Default, e };
|
||||
break;
|
||||
|
||||
case StyleType.SelectedMouseOver:
|
||||
css = new StyleType[] { StyleType.Default, StyleType.Selected, e };
|
||||
break;
|
||||
}
|
||||
|
||||
return (css);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public BaseVisualStyle Copy()
|
||||
{
|
||||
BaseVisualStyle style = new BaseVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(BaseVisualStyle copy)
|
||||
{
|
||||
copy.Class = _Class;
|
||||
copy.Tag = _Tag;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSerialData
|
||||
|
||||
internal virtual SerialElementCollection GetSerialData(string serialName)
|
||||
{
|
||||
if ((String.IsNullOrEmpty(Class) == false) || (Tag != null))
|
||||
{
|
||||
SerialElementCollection sec = new SerialElementCollection();
|
||||
|
||||
if (serialName != null)
|
||||
{
|
||||
if (serialName.Equals("") == true)
|
||||
serialName = "BaseVisualStyle";
|
||||
|
||||
sec.AddStartElement(serialName);
|
||||
}
|
||||
|
||||
sec.AddValue("Class", Class, "");
|
||||
sec.AddValue("Tag", Tag, null);
|
||||
|
||||
if (serialName != null)
|
||||
sec.AddEndElement(serialName);
|
||||
|
||||
return (sec);
|
||||
}
|
||||
|
||||
return (null);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PutSerialData
|
||||
|
||||
#region ProcessValue
|
||||
|
||||
void IProcessSerialElement.ProcessValue(SerialElement se)
|
||||
{
|
||||
ProcessValue(se);
|
||||
}
|
||||
|
||||
internal virtual void ProcessValue(SerialElement se)
|
||||
{
|
||||
switch (se.Name)
|
||||
{
|
||||
case "Name":
|
||||
Class = se.StringValue;
|
||||
break;
|
||||
|
||||
case "Tag":
|
||||
Tag = se.DataValue;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Exception("Unknown Serial Value (" + se.Name + ")");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ProcessCollection
|
||||
|
||||
void IProcessSerialElement.ProcessCollection(SerialElement se)
|
||||
{
|
||||
ProcessCollection(se);
|
||||
}
|
||||
|
||||
internal virtual void ProcessCollection(SerialElement se)
|
||||
{
|
||||
throw new Exception("Unknown Serial Collection (" + se.Name + ")");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyDefaults
|
||||
|
||||
public virtual void ApplyDefaults()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region INotifyPropertyChanged Members
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when property value has changed.
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Raises the PropertyChanged event.
|
||||
/// </summary>
|
||||
/// <param name="e">Event arguments</param>
|
||||
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
|
||||
{
|
||||
if ((StyleUpdateMode & StyleUpdateMode.UpdateCount) == StyleUpdateMode.UpdateCount)
|
||||
StyleUpdateCount++;
|
||||
|
||||
if ((StyleUpdateMode & StyleUpdateMode.Notify) == StyleUpdateMode.Notify)
|
||||
{
|
||||
if (PropertyChanged != null)
|
||||
PropertyChanged(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Default PropertyChanged processing
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
protected void OnPropertyChanged(string s)
|
||||
{
|
||||
if ((StyleUpdateMode & StyleUpdateMode.UpdateCount) == StyleUpdateMode.UpdateCount)
|
||||
StyleUpdateCount++;
|
||||
|
||||
if (PropertyChanged != null)
|
||||
OnPropertyChanged(new VisualPropertyChangedEventArgs(s));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Default PropertyChanged processing
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
/// <param name="changeType">invalidate</param>
|
||||
protected void OnPropertyChangedEx(string s, VisualChangeType changeType)
|
||||
{
|
||||
if ((StyleUpdateMode & StyleUpdateMode.UpdateCount) == StyleUpdateMode.UpdateCount)
|
||||
StyleUpdateCount++;
|
||||
|
||||
if (PropertyChanged != null)
|
||||
OnPropertyChanged(new VisualPropertyChangedEventArgs(s, changeType));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region UpdateChangeHandler
|
||||
|
||||
/// <summary>
|
||||
/// UpdateChangeHandler
|
||||
/// </summary>
|
||||
/// <param name="oldValue"></param>
|
||||
/// <param name="newValue"></param>
|
||||
protected void UpdateChangeHandler(
|
||||
INotifyPropertyChanged oldValue, INotifyPropertyChanged newValue)
|
||||
{
|
||||
if (oldValue != null)
|
||||
oldValue.PropertyChanged -= ValuePropertyChanged;
|
||||
|
||||
if (newValue != null)
|
||||
newValue.PropertyChanged += ValuePropertyChanged;
|
||||
}
|
||||
|
||||
void ValuePropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
OnPropertyChanged(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnStyleChanged
|
||||
|
||||
protected void OnStyleChanged(string property,
|
||||
INotifyPropertyChanged oldValue, INotifyPropertyChanged newValue)
|
||||
{
|
||||
UpdateChangeHandler(oldValue, newValue);
|
||||
|
||||
OnPropertyChanged(property);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public virtual void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region enums
|
||||
|
||||
#region StyleState
|
||||
|
||||
///<summary>
|
||||
/// StyleState
|
||||
///</summary>
|
||||
[Flags]
|
||||
public enum StyleState
|
||||
{
|
||||
///<summary>
|
||||
/// Default
|
||||
///</summary>
|
||||
Default = 0,
|
||||
|
||||
///<summary>
|
||||
/// MouseOver
|
||||
///</summary>
|
||||
MouseOver = (1 << 0),
|
||||
|
||||
///<summary>
|
||||
/// Selected
|
||||
///</summary>
|
||||
Selected = (1 << 1),
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StyleType
|
||||
|
||||
///<summary>
|
||||
/// StyleType
|
||||
///</summary>
|
||||
public enum StyleType
|
||||
{
|
||||
///<summary>
|
||||
/// CellStyle is Not Set
|
||||
///</summary>
|
||||
NotSet = -1,
|
||||
|
||||
///<summary>
|
||||
/// Default
|
||||
///</summary>
|
||||
Default = 0,
|
||||
|
||||
///<summary>
|
||||
/// MouseOver
|
||||
///</summary>
|
||||
MouseOver,
|
||||
|
||||
///<summary>
|
||||
/// Selected
|
||||
///</summary>
|
||||
Selected,
|
||||
|
||||
///<summary>
|
||||
/// SelectedMouseOver
|
||||
///</summary>
|
||||
SelectedMouseOver,
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StyleUpdateMode
|
||||
|
||||
[Flags]
|
||||
internal enum StyleUpdateMode
|
||||
{
|
||||
None = 0,
|
||||
|
||||
Notify = (1 << 0),
|
||||
UpdateCount = (1 << 1),
|
||||
|
||||
Full = (UpdateCount | Notify),
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Tbool
|
||||
|
||||
///<summary>
|
||||
/// TBool - Three state boolean
|
||||
///</summary>
|
||||
public enum Tbool
|
||||
{
|
||||
///<summary>
|
||||
/// NotSet
|
||||
///</summary>
|
||||
NotSet,
|
||||
|
||||
///<summary>
|
||||
/// True
|
||||
///</summary>
|
||||
True,
|
||||
|
||||
///<summary>
|
||||
/// False
|
||||
///</summary>
|
||||
False
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region VisualChangeType
|
||||
|
||||
/// <summary>
|
||||
/// Defines visual property change type.
|
||||
/// </summary>
|
||||
public enum VisualChangeType
|
||||
{
|
||||
/// <summary>
|
||||
/// Visual style has changed so Recalc is needed
|
||||
/// </summary>
|
||||
Recalc,
|
||||
|
||||
/// <summary>
|
||||
/// Visual style has changed so layout is impacted, but not recalc
|
||||
/// </summary>
|
||||
Layout,
|
||||
|
||||
/// <summary>
|
||||
/// Visual style has changed so visuals are impacted, but not layout
|
||||
/// </summary>
|
||||
Render
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region VisualPropertyChangedEventArgs
|
||||
|
||||
/// <summary>
|
||||
/// Represents visual property changed event arguments.
|
||||
/// </summary>
|
||||
public class VisualPropertyChangedEventArgs : PropertyChangedEventArgs
|
||||
{
|
||||
#region Public data
|
||||
|
||||
/// <summary>
|
||||
/// Gets the change type.
|
||||
/// </summary>
|
||||
public readonly VisualChangeType ChangeType;
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the VisualPropertyChangedEventArgs class.
|
||||
/// </summary>
|
||||
public VisualPropertyChangedEventArgs(string propertyName)
|
||||
: base(propertyName)
|
||||
{
|
||||
ChangeType = VisualChangeType.Layout;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the VisualPropertyChangedEventArgs class.
|
||||
/// </summary>
|
||||
public VisualPropertyChangedEventArgs(string propertyName, VisualChangeType changeType)
|
||||
: base(propertyName)
|
||||
{
|
||||
ChangeType = changeType;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region VisualStylesConverter
|
||||
|
||||
///<summary>
|
||||
/// VisualStylesConverter
|
||||
///</summary>
|
||||
public class VisualStylesConverter : ExpandableObjectConverter
|
||||
{
|
||||
/// <summary>
|
||||
/// ConvertTo
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="culture"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="destinationType"></param>
|
||||
/// <returns></returns>
|
||||
public override object ConvertTo(
|
||||
ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
|
||||
{
|
||||
if (destinationType == typeof(string))
|
||||
return (" ");
|
||||
|
||||
return (base.ConvertTo(context, culture, value, destinationType));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region DefaultStyleConvertor
|
||||
|
||||
public class DefaultStyleConvertor : ExpandableObjectConverter
|
||||
{
|
||||
public override object ConvertTo(
|
||||
ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
|
||||
{
|
||||
if (destinationType == typeof(string))
|
||||
{
|
||||
BaseVisualStyle bvs = value as BaseVisualStyle;
|
||||
|
||||
if (bvs != null)
|
||||
{
|
||||
ColorConverter cvt = new ColorConverter();
|
||||
|
||||
return ((bvs.IsEmpty == true) ? " " : "(Set)");
|
||||
}
|
||||
}
|
||||
|
||||
return (base.ConvertTo(context, culture, value, destinationType));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,670 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Drawing.Design;
|
||||
using System.Collections;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents style border color.
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(BorderColorConverter))]
|
||||
public class BorderColor : IProcessSerialElement, INotifyPropertyChanged
|
||||
{
|
||||
#region Static data
|
||||
|
||||
///<summary>
|
||||
/// Empty
|
||||
///</summary>
|
||||
/// <summary>
|
||||
/// Returns Empty instance of BorderColor.
|
||||
/// </summary>
|
||||
public static BorderColor Empty
|
||||
{
|
||||
get { return (new BorderColor()); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private variables
|
||||
|
||||
private Color _Top = Color.Empty;
|
||||
private Color _Left = Color.Empty;
|
||||
private Color _Bottom = Color.Empty;
|
||||
private Color _Right = Color.Empty;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the BorderColor object.
|
||||
/// </summary>
|
||||
/// <param name="left"></param>
|
||||
/// <param name="top"></param>
|
||||
/// <param name="right"></param>
|
||||
/// <param name="bottom"></param>
|
||||
public BorderColor(Color left, Color top, Color right, Color bottom)
|
||||
{
|
||||
_Top = top;
|
||||
_Bottom = bottom;
|
||||
_Left = left;
|
||||
_Right = right;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the BorderColor object.
|
||||
/// </summary>
|
||||
public BorderColor(Color all)
|
||||
: this(all, all, all, all)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the BorderColor object.
|
||||
/// </summary>
|
||||
public BorderColor()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region All
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the color of all borders.
|
||||
/// </summary>
|
||||
//[Browsable(false)]
|
||||
//[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public Color All
|
||||
{
|
||||
set { _Top = _Left = _Bottom = _Right = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Bottom
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the bottom border
|
||||
/// </summary>
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates the color of the bottom border")]
|
||||
public Color Bottom
|
||||
{
|
||||
get { return (_Bottom); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Bottom != value)
|
||||
{
|
||||
_Bottom = value;
|
||||
|
||||
OnVisualPropertyChanged("Bottom");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public bool ShouldSerializeBottom()
|
||||
{
|
||||
return (_Bottom.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public void ResetBottom()
|
||||
{
|
||||
Bottom = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Left
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the left border
|
||||
/// </summary>
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates the color of the left border")]
|
||||
public Color Left
|
||||
{
|
||||
get { return (_Left); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Left != value)
|
||||
{
|
||||
_Left = value;
|
||||
|
||||
OnVisualPropertyChanged("Left");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public bool ShouldSerializeLeft()
|
||||
{
|
||||
return (_Left.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public void ResetLeft()
|
||||
{
|
||||
Left = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Right
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the right border
|
||||
/// </summary>
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates the color of the right border")]
|
||||
public Color Right
|
||||
{
|
||||
get { return (_Right); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Right != value)
|
||||
{
|
||||
_Right = value;
|
||||
|
||||
OnVisualPropertyChanged("Right");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public bool ShouldSerializeRight()
|
||||
{
|
||||
return (_Right.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public void ResetRight()
|
||||
{
|
||||
Right = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Top
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the top border
|
||||
/// </summary>
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates the color of the top border")]
|
||||
public Color Top
|
||||
{
|
||||
get { return (_Top); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Top != value)
|
||||
{
|
||||
_Top = value;
|
||||
|
||||
OnVisualPropertyChanged("Top");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public bool ShouldSerializeTop()
|
||||
{
|
||||
return (_Top.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public void ResetTop()
|
||||
{
|
||||
Top = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal properties
|
||||
|
||||
#region IsEmpty
|
||||
|
||||
internal bool IsEmpty
|
||||
{
|
||||
get
|
||||
{
|
||||
return (_Left.IsEmpty && _Top.IsEmpty &&
|
||||
_Right.IsEmpty && _Bottom.IsEmpty);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsUniform
|
||||
|
||||
internal bool IsUniform
|
||||
{
|
||||
get
|
||||
{
|
||||
return (_Left == _Top &&
|
||||
_Left == _Right && _Left == _Bottom);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Operators
|
||||
|
||||
#region '==' operator
|
||||
|
||||
/// <summary>
|
||||
/// Compares two instances.
|
||||
/// </summary>
|
||||
/// <param name="t1">Instance 1</param>
|
||||
/// <param name="t2">Instance 2</param>
|
||||
/// <returns>true if same</returns>
|
||||
public static bool operator ==(BorderColor t1, BorderColor t2)
|
||||
{
|
||||
// If both are null, or both are same instance, return true.
|
||||
|
||||
if (ReferenceEquals(t1, t2))
|
||||
return (true);
|
||||
|
||||
// If one is null, but not both, return false.
|
||||
|
||||
if (((object)t1 == null) || ((object)t2 == null))
|
||||
return (false);
|
||||
|
||||
return (t1._Left == t2._Left && t1._Right == t2._Right &&
|
||||
t1._Top == t2._Top && t1._Bottom == t2._Bottom);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region "!=" operator
|
||||
|
||||
/// <summary>
|
||||
/// Compares two instances.
|
||||
/// </summary>
|
||||
/// <param name="t1">Instance 1</param>
|
||||
/// <param name="t2">Instance 2</param>
|
||||
/// <returns>true if different.</returns>
|
||||
public static bool operator !=(BorderColor t1, BorderColor t2)
|
||||
{
|
||||
return ((t1 == t2) == false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetHashCode
|
||||
|
||||
/// <summary>
|
||||
/// Returns hash-code for object.
|
||||
/// </summary>
|
||||
/// <returns>Hash-code value.</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return (((_Left.GetHashCode() ^ _Top.GetHashCode()) ^
|
||||
_Right.GetHashCode()) ^ _Bottom.GetHashCode());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Equals
|
||||
|
||||
/// <summary>
|
||||
/// Compares object to this instance.
|
||||
/// </summary>
|
||||
/// <param name="obj">Object to compare.</param>
|
||||
/// <returns>true if same.</returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is BorderColor)
|
||||
return ((BorderColor) obj == this);
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compares object to this instance.
|
||||
/// </summary>
|
||||
/// <param name="borderColor">Border color</param>
|
||||
/// <returns>true if same</returns>
|
||||
public bool Equals(BorderColor borderColor)
|
||||
{
|
||||
return (this == borderColor);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Creates an exact copy of the BorderColor.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the BorderColor.</returns>
|
||||
public BorderColor Copy()
|
||||
{
|
||||
BorderColor copy = new BorderColor(_Left, _Top, _Right, _Bottom);
|
||||
|
||||
return (copy);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSerialData
|
||||
|
||||
internal SerialElementCollection GetSerialData(string serialName)
|
||||
{
|
||||
SerialElementCollection sec = new SerialElementCollection();
|
||||
|
||||
if (serialName != null)
|
||||
{
|
||||
if (serialName.Equals("") == true)
|
||||
serialName = "BorderColor";
|
||||
|
||||
sec.AddStartElement(serialName);
|
||||
}
|
||||
|
||||
if (IsUniform == true)
|
||||
{
|
||||
sec.AddValue("All", Left, Color.Empty);
|
||||
}
|
||||
else
|
||||
{
|
||||
sec.AddValue("Left", Left, Color.Empty);
|
||||
sec.AddValue("Top", Top, Color.Empty);
|
||||
sec.AddValue("Right", Right, Color.Empty);
|
||||
sec.AddValue("Bottom", Bottom, Color.Empty);
|
||||
}
|
||||
|
||||
if (serialName != null)
|
||||
sec.AddEndElement(serialName);
|
||||
|
||||
return (sec);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PutSerialData
|
||||
|
||||
#region ProcessValue
|
||||
|
||||
void IProcessSerialElement.ProcessValue(SerialElement se)
|
||||
{
|
||||
switch (se.Name)
|
||||
{
|
||||
case "All":
|
||||
All = (Color)se.ColorValue;
|
||||
break;
|
||||
|
||||
case "Left":
|
||||
Left = (Color)se.ColorValue;
|
||||
break;
|
||||
|
||||
case "Top":
|
||||
Top = (Color)se.ColorValue;
|
||||
break;
|
||||
|
||||
case "Right":
|
||||
Right = (Color)se.ColorValue;
|
||||
break;
|
||||
|
||||
case "Bottom":
|
||||
Bottom = (Color)se.ColorValue;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Exception("Unknown Serial Value (" + se.Name + ")");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ProcessCollection
|
||||
|
||||
void IProcessSerialElement.ProcessCollection(SerialElement se)
|
||||
{
|
||||
throw new Exception("Unknown Serial Collection (" + se.Name + ")");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region INotifyPropertyChanged Members
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when property value has changed.
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Raises the PropertyChanged event.
|
||||
/// </summary>
|
||||
/// <param name="e">Event arguments</param>
|
||||
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
|
||||
{
|
||||
PropertyChangedEventHandler eh = PropertyChanged;
|
||||
|
||||
if (eh != null)
|
||||
eh(this, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Default PropertyChanged processing
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
protected void OnPropertyChanged(string s)
|
||||
{
|
||||
if (PropertyChanged != null)
|
||||
OnPropertyChanged(new PropertyChangedEventArgs(s));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Default PropertyChanged processing
|
||||
/// </summary>
|
||||
/// <param name="s"></param>
|
||||
protected void OnVisualPropertyChanged(string s)
|
||||
{
|
||||
if (PropertyChanged != null)
|
||||
OnPropertyChanged(new VisualPropertyChangedEventArgs(s));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region BorderColorConverter
|
||||
|
||||
///<summary>
|
||||
/// BorderColorConverter
|
||||
///</summary>
|
||||
public class BorderColorConverter : ExpandableObjectConverter
|
||||
{
|
||||
#region CanConvertTo
|
||||
|
||||
/// <summary>
|
||||
/// CanConvertTo
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="destinationType"></param>
|
||||
/// <returns></returns>
|
||||
public override bool CanConvertTo(
|
||||
ITypeDescriptorContext context, Type destinationType)
|
||||
{
|
||||
if (destinationType == typeof(string))
|
||||
return (true);
|
||||
|
||||
return (base.CanConvertTo(context, destinationType));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ConvertTo
|
||||
|
||||
/// <summary>
|
||||
/// ConvertTo
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="culture"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="destinationType"></param>
|
||||
/// <returns></returns>
|
||||
public override object ConvertTo(
|
||||
ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
|
||||
{
|
||||
if (destinationType == typeof(string))
|
||||
{
|
||||
BorderColor bc = value as BorderColor;
|
||||
|
||||
if (bc != null)
|
||||
{
|
||||
if (bc.IsUniform == true)
|
||||
return (bc.Left.ToString());
|
||||
|
||||
return (String.Format("{0}, {1}, {2}, {3}",
|
||||
bc.Bottom, bc.Left, bc.Right, bc.Top));
|
||||
}
|
||||
}
|
||||
|
||||
return (base.ConvertTo(context, culture, value, destinationType));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CanConvertFrom
|
||||
|
||||
/// <summary>
|
||||
/// CanConvertFrom
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="sourceType"></param>
|
||||
/// <returns></returns>
|
||||
public override bool CanConvertFrom(
|
||||
ITypeDescriptorContext context, Type sourceType)
|
||||
{
|
||||
if (sourceType == typeof(string))
|
||||
return (true);
|
||||
|
||||
return (base.CanConvertFrom(context, sourceType));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ConvertFrom
|
||||
|
||||
/// <summary>
|
||||
/// ConvertFrom
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="culture"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public override object ConvertFrom(
|
||||
ITypeDescriptorContext context, CultureInfo culture, object value)
|
||||
{
|
||||
if (value is string)
|
||||
{
|
||||
string[] values = ((string)value).Split(',');
|
||||
|
||||
if (values.Length != 1 && values.Length != 4)
|
||||
throw new ArgumentException("Invalid value to convert.");
|
||||
|
||||
ColorConverter cvt = new ColorConverter();
|
||||
|
||||
try
|
||||
{
|
||||
Color[] c = new Color[values.Length];
|
||||
|
||||
for (int i = 0; i < values.Length; i++)
|
||||
c[i] = (Color)cvt.ConvertFrom(values[i]);
|
||||
|
||||
BorderColor bc = (values.Length == 1)
|
||||
? new BorderColor(c[0])
|
||||
: new BorderColor(c[1], c[3], c[2], c[0]);
|
||||
|
||||
return (bc);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw new ArgumentException("Invalid value to convert.");
|
||||
}
|
||||
}
|
||||
|
||||
return base.ConvertFrom(context, culture, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetCreateInstanceSupported
|
||||
|
||||
/// <summary>
|
||||
/// GetCreateInstanceSupported
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <returns></returns>
|
||||
public override bool GetCreateInstanceSupported(ITypeDescriptorContext context)
|
||||
{
|
||||
return (true);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CreateInstance
|
||||
|
||||
/// <summary>
|
||||
/// CreateInstance
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="propertyValues"></param>
|
||||
/// <returns></returns>
|
||||
public override object CreateInstance(
|
||||
ITypeDescriptorContext context, IDictionary propertyValues)
|
||||
{
|
||||
return (new BorderColor((Color)propertyValues["Left"], (Color)propertyValues["Top"],
|
||||
(Color)propertyValues["Right"], (Color)propertyValues["Bottom"]));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,524 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing.Drawing2D;
|
||||
using DevComponents.DotNetBar.Charts.Primitives;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines Thickness class.
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(BlankExpandableObjectConverter))]
|
||||
public class BorderPattern : IEquatable<BorderPattern>, IProcessSerialElement, INotifyPropertyChanged
|
||||
{
|
||||
#region Static data
|
||||
|
||||
/// <summary>
|
||||
/// Returns Empty instance of BorderPattern.
|
||||
/// </summary>
|
||||
public static BorderPattern Empty
|
||||
{
|
||||
get { return (new BorderPattern()); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private variables
|
||||
|
||||
private LinePattern _Bottom = LinePattern.NotSet;
|
||||
private LinePattern _Left = LinePattern.NotSet;
|
||||
private LinePattern _Right = LinePattern.NotSet;
|
||||
private LinePattern _Top = LinePattern.NotSet;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Creates new instance of the object.
|
||||
/// </summary>
|
||||
/// <param name="left">Left BorderPatternStyle.</param>
|
||||
/// <param name="top">Top BorderPatternStyle.</param>
|
||||
/// <param name="right">Right BorderPatternStyle.</param>
|
||||
/// <param name="bottom">Bottom BorderPatternStyle.</param>
|
||||
public BorderPattern(LinePattern left,
|
||||
LinePattern top, LinePattern right, LinePattern bottom)
|
||||
{
|
||||
_Left = left;
|
||||
_Top = top;
|
||||
_Right = right;
|
||||
_Bottom = bottom;
|
||||
|
||||
PropertyChanged = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates new instance of the object.
|
||||
/// </summary>
|
||||
/// <param name="all">Specifies uniform Thickness.</param>
|
||||
public BorderPattern(LinePattern all)
|
||||
: this(all, all, all, all)
|
||||
{
|
||||
}
|
||||
|
||||
///<summary>
|
||||
/// Creates new instance of the object.
|
||||
///</summary>
|
||||
public BorderPattern()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region All
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the thickness of all sides.
|
||||
/// </summary>
|
||||
//[Browsable(false)]
|
||||
//[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public LinePattern All
|
||||
{
|
||||
set { _Top = _Left = _Bottom = _Right = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Bottom
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the bottom Border Pattern
|
||||
/// </summary>
|
||||
[DefaultValue(LinePattern.NotSet)]
|
||||
[Description("Indicates the bottom Border Pattern")]
|
||||
public LinePattern Bottom
|
||||
{
|
||||
get { return (_Bottom); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Bottom != value)
|
||||
{
|
||||
_Bottom = value;
|
||||
|
||||
OnPropertyChanged(new VisualPropertyChangedEventArgs("Bottom"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Left
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the left Border Pattern
|
||||
/// </summary>
|
||||
[DefaultValue(LinePattern.NotSet)]
|
||||
[Description("Indicates the left Border Pattern")]
|
||||
public LinePattern Left
|
||||
{
|
||||
get { return (_Left); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Left != value)
|
||||
{
|
||||
_Left = value;
|
||||
|
||||
OnPropertyChanged(new VisualPropertyChangedEventArgs("Left"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Right
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Right Border Pattern
|
||||
/// </summary>
|
||||
[DefaultValue(LinePattern.NotSet)]
|
||||
[Description("Indicates the Right Border Pattern")]
|
||||
public LinePattern Right
|
||||
{
|
||||
get { return (_Right); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Right != value)
|
||||
{
|
||||
_Right = value;
|
||||
|
||||
OnPropertyChanged(new VisualPropertyChangedEventArgs("Right"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Top
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Top Border Pattern
|
||||
/// </summary>
|
||||
[Browsable(true), DefaultValue(LinePattern.NotSet)]
|
||||
[Description("Indicates the Top Border Pattern")]
|
||||
public LinePattern Top
|
||||
{
|
||||
get { return (_Top); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Top != value)
|
||||
{
|
||||
_Top = value;
|
||||
|
||||
OnPropertyChanged(new VisualPropertyChangedEventArgs("Top"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsEmpty
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the item is empty
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsEmpty
|
||||
{
|
||||
get
|
||||
{
|
||||
return (_Left == LinePattern.NotSet &&
|
||||
_Right == LinePattern.NotSet &&
|
||||
_Top == LinePattern.NotSet &&
|
||||
_Bottom == LinePattern.NotSet);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal properties
|
||||
|
||||
#region IsUniform
|
||||
|
||||
internal bool IsUniform
|
||||
{
|
||||
get
|
||||
{
|
||||
return (_Left == _Top &&
|
||||
_Left == _Right && _Left == _Bottom);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Equals
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether two instances are equal.
|
||||
/// </summary>
|
||||
/// <param name="obj">Instance to compare to.</param>
|
||||
/// <returns>true if equal otherwise false.</returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is BorderPattern)
|
||||
return (this == (BorderPattern)obj);
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether two instances are equal.
|
||||
/// </summary>
|
||||
/// <param name="borderPattern">Instance to compare to</param>
|
||||
/// <returns>true if equal otherwise false</returns>
|
||||
public bool Equals(BorderPattern borderPattern)
|
||||
{
|
||||
return (this == borderPattern);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetHashCode
|
||||
|
||||
/// <summary>
|
||||
/// Returns hash-code.
|
||||
/// </summary>
|
||||
/// <returns>hash-code</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return (((_Left.GetHashCode() ^ _Top.GetHashCode()) ^
|
||||
_Right.GetHashCode()) ^ _Bottom.GetHashCode());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Operators
|
||||
|
||||
#region "==" operator
|
||||
|
||||
/// <summary>
|
||||
/// Implements == operator.
|
||||
/// </summary>
|
||||
/// <param name="t1">Object 1</param>
|
||||
/// <param name="t2">Object 2</param>
|
||||
/// <returns>true if equals</returns>
|
||||
public static bool operator ==(BorderPattern t1, BorderPattern t2)
|
||||
{
|
||||
if (ReferenceEquals(t1, t2))
|
||||
return (true);
|
||||
|
||||
if (((object)t1 == null) || ((object)t2 == null))
|
||||
return (false);
|
||||
|
||||
return (t1._Left == t2._Left && t1._Right == t2._Right &&
|
||||
t1._Top == t2._Top && t1._Bottom == t2._Bottom);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region "!=" operator
|
||||
|
||||
/// <summary>
|
||||
/// Implements != operator
|
||||
/// </summary>
|
||||
/// <param name="t1">Object 1</param>
|
||||
/// <param name="t2">Object 2</param>
|
||||
/// <returns>true if different</returns>
|
||||
public static bool operator !=(BorderPattern t1, BorderPattern t2)
|
||||
{
|
||||
return ((t1 == t2) == false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyPattern
|
||||
|
||||
/// <summary>
|
||||
/// Applies the pattern to instance of this pattern.
|
||||
/// </summary>
|
||||
/// <param name="pattern">Pattern to apply.</param>
|
||||
public void ApplyPattern(BorderPattern pattern)
|
||||
{
|
||||
if (pattern != null)
|
||||
{
|
||||
if (pattern.Top != LinePattern.NotSet)
|
||||
_Top = pattern.Top;
|
||||
|
||||
if (pattern.Left != LinePattern.NotSet)
|
||||
_Left = pattern.Left;
|
||||
|
||||
if (pattern.Bottom != LinePattern.NotSet)
|
||||
_Bottom = pattern.Bottom;
|
||||
|
||||
if (pattern.Right != LinePattern.NotSet)
|
||||
_Right = pattern.Right;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Creates an exact copy of the BorderPattern.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the BorderPattern.</returns>
|
||||
public BorderPattern Copy()
|
||||
{
|
||||
BorderPattern copy = new BorderPattern(_Left, _Top, _Right, _Bottom);
|
||||
|
||||
return (copy);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSerialData
|
||||
|
||||
internal SerialElementCollection GetSerialData(string serialName)
|
||||
{
|
||||
SerialElementCollection sec = new SerialElementCollection();
|
||||
|
||||
if (serialName != null)
|
||||
{
|
||||
if (serialName.Equals("") == true)
|
||||
serialName = "BorderPattern";
|
||||
|
||||
sec.AddStartElement(serialName);
|
||||
}
|
||||
|
||||
if (IsUniform == true)
|
||||
{
|
||||
sec.AddValue("All", Left, LinePattern.NotSet);
|
||||
}
|
||||
else
|
||||
{
|
||||
sec.AddValue("Left", Left, LinePattern.NotSet);
|
||||
sec.AddValue("Top", Top, LinePattern.NotSet);
|
||||
sec.AddValue("Right", Right, LinePattern.NotSet);
|
||||
sec.AddValue("Bottom", Bottom, LinePattern.NotSet);
|
||||
}
|
||||
|
||||
if (serialName != null)
|
||||
sec.AddEndElement(serialName);
|
||||
|
||||
return (sec);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PutSerialData
|
||||
|
||||
#region ProcessValue
|
||||
|
||||
void IProcessSerialElement.ProcessValue(SerialElement se)
|
||||
{
|
||||
switch (se.Name)
|
||||
{
|
||||
case "All":
|
||||
All = (LinePattern)se.GetValueEnum(typeof(LinePattern));
|
||||
break;
|
||||
|
||||
case "Left":
|
||||
Left = (LinePattern)se.GetValueEnum(typeof(LinePattern));
|
||||
break;
|
||||
|
||||
case "Top":
|
||||
Top = (LinePattern)se.GetValueEnum(typeof(LinePattern));
|
||||
break;
|
||||
|
||||
case "Right":
|
||||
Right = (LinePattern)se.GetValueEnum(typeof(LinePattern));
|
||||
break;
|
||||
|
||||
case "Bottom":
|
||||
Bottom = (LinePattern)se.GetValueEnum(typeof(LinePattern));
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Exception("Unknown Serial Value (" + se.Name + ")");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ProcessCollection
|
||||
|
||||
void IProcessSerialElement.ProcessCollection(SerialElement se)
|
||||
{
|
||||
throw new Exception("Unknown Serial Collection (" + se.Name + ")");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region INotifyPropertyChanged Members
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when property value has changed.
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Raises the PropertyChanged event.
|
||||
/// </summary>
|
||||
/// <param name="e">Event arguments</param>
|
||||
void OnPropertyChanged(VisualPropertyChangedEventArgs e)
|
||||
{
|
||||
PropertyChangedEventHandler eh = PropertyChanged;
|
||||
|
||||
if (eh != null)
|
||||
eh(this, e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region enums
|
||||
|
||||
#region LinePattern
|
||||
|
||||
///<summary>
|
||||
/// LinePattern
|
||||
///</summary>
|
||||
public enum LinePattern
|
||||
{
|
||||
///<summary>
|
||||
/// None
|
||||
///</summary>
|
||||
None = -2,
|
||||
|
||||
///<summary>
|
||||
/// NotSet
|
||||
///</summary>
|
||||
NotSet = -1,
|
||||
|
||||
///<summary>
|
||||
/// Solid
|
||||
///</summary>
|
||||
Solid = DashStyle.Solid,
|
||||
|
||||
///<summary>
|
||||
/// Dash
|
||||
///</summary>
|
||||
Dash = DashStyle.Dash,
|
||||
|
||||
///<summary>
|
||||
/// Dot
|
||||
///</summary>
|
||||
Dot = DashStyle.Dot,
|
||||
|
||||
///<summary>
|
||||
/// DashDot
|
||||
///</summary>
|
||||
DashDot = DashStyle.DashDot,
|
||||
|
||||
///<summary>
|
||||
/// DashDotDot
|
||||
///</summary>
|
||||
DashDotDot = DashStyle.DashDotDot,
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ChartLineCap
|
||||
|
||||
///<summary>
|
||||
/// ChartLineCap
|
||||
///</summary>
|
||||
public enum ChartLineCap
|
||||
{
|
||||
///<summary>
|
||||
/// NotSet
|
||||
///</summary>
|
||||
NotSet = -1,
|
||||
|
||||
Flat = 0,
|
||||
Square = 1,
|
||||
Round = 2,
|
||||
Triangle = 3,
|
||||
NoAnchor = 16,
|
||||
SquareAnchor = 17,
|
||||
RoundAnchor = 18,
|
||||
DiamondAnchor = 19,
|
||||
ArrowAnchor = 20,
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
@@ -0,0 +1,325 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
///<summary>
|
||||
/// ChartAxisVisualStyles
|
||||
///</summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class ChartAxisVisualStyles : VisualStyles<ChartAxisVisualStyle>
|
||||
{
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public ChartAxisVisualStyles Copy()
|
||||
{
|
||||
ChartAxisVisualStyles styles = new ChartAxisVisualStyles();
|
||||
|
||||
for (int i = 0; i < Styles.Length; i++)
|
||||
{
|
||||
ChartAxisVisualStyle vstyle = Styles[i];
|
||||
|
||||
if (vstyle != null)
|
||||
styles.Styles[i] = vstyle.Copy();
|
||||
}
|
||||
|
||||
return (styles);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the visual style of a ChartAxis element.
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class ChartAxisVisualStyle : BaseVisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private Color _AxisColor = Color.Empty;
|
||||
private Background _AlternateBackground;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region AlternateBackground
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the alternate, or interlaced, background.
|
||||
/// </summary>
|
||||
[Description("Indicates the alternate, or interlaced, background")]
|
||||
public Background AlternateBackground
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_AlternateBackground == null)
|
||||
{
|
||||
_AlternateBackground = Background.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _AlternateBackground);
|
||||
}
|
||||
|
||||
return (_AlternateBackground);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_AlternateBackground != value)
|
||||
{
|
||||
UpdateChangeHandler(_AlternateBackground, value);
|
||||
|
||||
_AlternateBackground = value;
|
||||
|
||||
OnPropertyChangedEx("AlternateBackground", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeAlternateBackground()
|
||||
{
|
||||
return (_AlternateBackground != null && _AlternateBackground.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetAlternateBackground()
|
||||
{
|
||||
AlternateBackground = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region AxisColor
|
||||
|
||||
///<summary>
|
||||
/// Gets or sets the Axis line Color.
|
||||
///</summary>
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates the Axis line Color.")]
|
||||
public Color AxisColor
|
||||
{
|
||||
get { return (_AxisColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _AxisColor)
|
||||
{
|
||||
_AxisColor = value;
|
||||
|
||||
OnPropertyChangedEx("AxisColor", Style.VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public bool ShouldSerializeAxisColor()
|
||||
{
|
||||
return (_AxisColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public void ResetAxisColor()
|
||||
{
|
||||
_AxisColor = 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 ((_AlternateBackground == null || _AlternateBackground.IsEmpty) &&
|
||||
(_AxisColor.IsEmpty == true) &&
|
||||
(base.IsEmpty == true));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(ChartAxisVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style._AlternateBackground != null && style.AlternateBackground.IsEmpty == false)
|
||||
AlternateBackground = style.AlternateBackground.Copy();
|
||||
|
||||
if (style.AxisColor.IsEmpty == false)
|
||||
AxisColor = style.AxisColor;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyDefaults
|
||||
|
||||
public override void ApplyDefaults()
|
||||
{
|
||||
if (AxisColor.IsEmpty == true)
|
||||
AxisColor = Color.Black;
|
||||
|
||||
if (AlternateBackground.IsEmpty == true)
|
||||
AlternateBackground = new Background(Color.Ivory);
|
||||
|
||||
base.ApplyDefaults();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new ChartAxisVisualStyle Copy()
|
||||
{
|
||||
ChartAxisVisualStyle style = new ChartAxisVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(ChartAxisVisualStyle style)
|
||||
{
|
||||
base.CopyTo(style);
|
||||
|
||||
style.AlternateBackground =
|
||||
(_AlternateBackground != null) ? _AlternateBackground.Copy() : null;
|
||||
|
||||
style.AxisColor = _AxisColor;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSerialData
|
||||
|
||||
internal override SerialElementCollection GetSerialData(string serialName)
|
||||
{
|
||||
SerialElementCollection sec = new SerialElementCollection();
|
||||
|
||||
if (serialName != null)
|
||||
{
|
||||
if (serialName.Equals("") == true)
|
||||
serialName = "ChartAxisVisualStyle";
|
||||
|
||||
sec.AddStartElement(serialName);
|
||||
}
|
||||
|
||||
if (_AlternateBackground != null && _AlternateBackground.IsEmpty == false)
|
||||
sec.AddElement(_AlternateBackground.GetSerialData("AlternateBackground"));
|
||||
|
||||
sec.AddValue("AxisColor", AxisColor, 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 "AxisColor":
|
||||
AxisColor = 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 "AlternateBackground":
|
||||
sec.PutSerialData(AlternateBackground);
|
||||
break;
|
||||
|
||||
default:
|
||||
base.ProcessCollection(se);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
AlternateBackground = null;
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,388 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing.Design;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the visual style of a Bar Series
|
||||
/// </summary>
|
||||
[ToolboxItem(false), DesignTimeVisible(false)]
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class ChartBarVisualStyle : BaseVisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private ChartLineVisualStyle _Border;
|
||||
private ChartLineVisualStyle _AlternateBorder;
|
||||
|
||||
private Background _Background;
|
||||
private Background _AlternateBackground;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region AlternateBackground
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the background for the bar, when it
|
||||
/// extends to the alternate side of the bar origin.
|
||||
/// </summary>
|
||||
[Description("Indicates the background for the bar, when it extends to the alternate side of the bar origin.")]
|
||||
public Background AlternateBackground
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_AlternateBackground == null)
|
||||
{
|
||||
_AlternateBackground = Background.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _AlternateBackground);
|
||||
}
|
||||
|
||||
return (_AlternateBackground);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_AlternateBackground != value)
|
||||
{
|
||||
UpdateChangeHandler(_AlternateBackground, value);
|
||||
|
||||
_AlternateBackground = value;
|
||||
|
||||
OnPropertyChangedEx("AlternateBackground", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeAlternateBackground()
|
||||
{
|
||||
return (_AlternateBackground != null && _AlternateBackground.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetAlternateBackground()
|
||||
{
|
||||
AlternateBackground = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region AlternateBorder
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the border style for the bar, when it
|
||||
/// extends to the alternate side of the bar origin.
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates the border style for the bar, when it extends to the alternate side of the bar origin.")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public ChartLineVisualStyle AlternateBorder
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_AlternateBorder == null)
|
||||
{
|
||||
_AlternateBorder = new ChartLineVisualStyle();
|
||||
|
||||
UpdateChangeHandler(null, _AlternateBorder);
|
||||
}
|
||||
|
||||
return (_AlternateBorder);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_AlternateBorder != value)
|
||||
{
|
||||
ChartLineVisualStyle oldValue = _AlternateBorder;
|
||||
|
||||
_AlternateBorder = value;
|
||||
|
||||
OnStyleChanged("AlternateBorder", oldValue, value);
|
||||
|
||||
if (oldValue != null)
|
||||
oldValue.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Background
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the background for the bar.
|
||||
/// </summary>
|
||||
[Description("Indicates the background for the bar.")]
|
||||
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 Border
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the border style for the bar.
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates the border style for the bar.")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public ChartLineVisualStyle Border
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Border == null)
|
||||
{
|
||||
_Border = new ChartLineVisualStyle();
|
||||
|
||||
UpdateChangeHandler(null, _Border);
|
||||
}
|
||||
|
||||
return (_Border);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_Border != value)
|
||||
{
|
||||
ChartLineVisualStyle oldValue = _Border;
|
||||
|
||||
_Border = value;
|
||||
|
||||
OnStyleChanged("Border", oldValue, value);
|
||||
|
||||
if (oldValue != null)
|
||||
oldValue.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#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 ((_AlternateBackground == null || _AlternateBackground.IsEmpty == true) &&
|
||||
(_AlternateBorder == null || _AlternateBorder.IsEmpty) &&
|
||||
(_Background == null || _Background.IsEmpty) &&
|
||||
(_Border == null || _Border.IsEmpty) &&
|
||||
(base.IsEmpty == true));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(ChartBarVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style._AlternateBackground != null && style._AlternateBackground.IsEmpty == false)
|
||||
AlternateBackground = style._AlternateBackground.Copy();
|
||||
|
||||
if (style._AlternateBorder != null && style._AlternateBorder.IsEmpty == false)
|
||||
AlternateBorder.ApplyStyle(style._AlternateBorder);
|
||||
|
||||
if (style._Background != null && style._Background.IsEmpty == false)
|
||||
Background = style._Background.Copy();
|
||||
|
||||
if (style._Border != null && style._Border.IsEmpty == false)
|
||||
Border.ApplyStyle(style._Border);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new ChartBarVisualStyle Copy()
|
||||
{
|
||||
ChartBarVisualStyle style = new ChartBarVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(ChartBarVisualStyle style)
|
||||
{
|
||||
base.CopyTo(style);
|
||||
|
||||
style.AlternateBackground = (_AlternateBackground != null) ? _AlternateBackground.Copy() : null;
|
||||
style.AlternateBorder = (_AlternateBorder != null) ? _AlternateBorder.Copy() : null;
|
||||
style.Background = (_Background != null) ? _Background.Copy() : null;
|
||||
style.Border = (_Border != null) ? _Border.Copy() : null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSerialData
|
||||
|
||||
internal override SerialElementCollection GetSerialData(string serialName)
|
||||
{
|
||||
SerialElementCollection sec = new SerialElementCollection();
|
||||
|
||||
if (serialName != null)
|
||||
{
|
||||
if (serialName.Equals("") == true)
|
||||
serialName = "ChartBarVisualStyle";
|
||||
|
||||
sec.AddStartElement(serialName);
|
||||
}
|
||||
|
||||
if (_AlternateBackground != null && _AlternateBackground.IsEmpty == false)
|
||||
sec.AddElement(_AlternateBackground.GetSerialData("AlternateBackground"));
|
||||
|
||||
if (_AlternateBorder != null && _AlternateBorder.IsEmpty == false)
|
||||
sec.AddElement(_AlternateBorder.GetSerialData("AlternateBorder"));
|
||||
|
||||
if (_Background != null && _Background.IsEmpty == false)
|
||||
sec.AddElement(_Background.GetSerialData("Background"));
|
||||
|
||||
if (_Border != null && _Border.IsEmpty == false)
|
||||
sec.AddElement(_Border.GetSerialData("Border"));
|
||||
|
||||
sec.AddElement(base.GetSerialData(null));
|
||||
|
||||
if (serialName != null)
|
||||
sec.AddEndElement(serialName);
|
||||
|
||||
return (sec);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PutSerialData
|
||||
|
||||
#region ProcessCollection
|
||||
|
||||
internal override void ProcessCollection(SerialElement se)
|
||||
{
|
||||
SerialElementCollection sec = se.Sec;
|
||||
|
||||
switch (se.Name)
|
||||
{
|
||||
case "AlternateBackground":
|
||||
sec.PutSerialData(AlternateBackground);
|
||||
break;
|
||||
|
||||
case "AlternateBorder":
|
||||
sec.PutSerialData(AlternateBorder);
|
||||
break;
|
||||
|
||||
case "Background":
|
||||
sec.PutSerialData(Background);
|
||||
break;
|
||||
|
||||
case "Border":
|
||||
sec.PutSerialData(Border);
|
||||
break;
|
||||
|
||||
default:
|
||||
base.ProcessCollection(se);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
AlternateBackground = null;
|
||||
Background = null;
|
||||
Border = null;
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,330 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing.Design;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the visual style of an Hilo Bar Series (OHLC)
|
||||
/// </summary>
|
||||
[ToolboxItem(false), DesignTimeVisible(false)]
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class ChartHiLoBarVisualStyle : BaseVisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private HiLoBarSegmentStyle _DefaultSegmentStyle;
|
||||
private HiLoBarSegmentStyle _AlternateSegmentStyle;
|
||||
|
||||
private Tbool _ShowWhiskerCaps = Tbool.NotSet;
|
||||
private Tbool _UseAlternateSegmentStyle = Tbool.NotSet;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region AlternateSegmentStyle
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Alternate Style for the Ohlc bar.
|
||||
/// </summary>
|
||||
[Description("Indicates the Alternate Style for the Ohlc bar.")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public HiLoBarSegmentStyle AlternateSegmentStyle
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_AlternateSegmentStyle == null)
|
||||
{
|
||||
_AlternateSegmentStyle = HiLoBarSegmentStyle.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _AlternateSegmentStyle);
|
||||
}
|
||||
|
||||
return (_AlternateSegmentStyle);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_AlternateSegmentStyle != value)
|
||||
{
|
||||
UpdateChangeHandler(_AlternateSegmentStyle, value);
|
||||
|
||||
_AlternateSegmentStyle = value;
|
||||
|
||||
OnPropertyChangedEx("AlternateSegmentStyle", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region DefaultSegmentStyle
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Default Style for the Ohlc bar.
|
||||
/// </summary>
|
||||
[Description("Indicates the Default Style for the Ohlc bar.")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public HiLoBarSegmentStyle DefaultSegmentStyle
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_DefaultSegmentStyle == null)
|
||||
{
|
||||
_DefaultSegmentStyle = HiLoBarSegmentStyle.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _DefaultSegmentStyle);
|
||||
}
|
||||
|
||||
return (_DefaultSegmentStyle);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_DefaultSegmentStyle != value)
|
||||
{
|
||||
UpdateChangeHandler(_DefaultSegmentStyle, value);
|
||||
|
||||
_DefaultSegmentStyle = value;
|
||||
|
||||
OnPropertyChangedEx("DefaultSegmentStyle", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ShowWhiskerCaps
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether Box/Candle whisker caps are displayed.
|
||||
/// </summary>
|
||||
[DefaultValue(Tbool.NotSet), Category("Appearance")]
|
||||
[Description("Indicates whether Box/Candle whisker caps are displayed.")]
|
||||
public Tbool ShowWhiskerCaps
|
||||
{
|
||||
get { return (_ShowWhiskerCaps); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _ShowWhiskerCaps)
|
||||
{
|
||||
_ShowWhiskerCaps = value;
|
||||
|
||||
OnPropertyChangedEx("ShowWhiskerCaps", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region UseAlternateSegmentStyle
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether Box/Candle whisker caps are displayed.
|
||||
/// </summary>
|
||||
[DefaultValue(Tbool.NotSet), Category("Appearance")]
|
||||
[Description("Indicates whether Box/Candle whisker caps are displayed.")]
|
||||
public Tbool UseAlternateSegmentStyle
|
||||
{
|
||||
get { return (_UseAlternateSegmentStyle); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _UseAlternateSegmentStyle)
|
||||
{
|
||||
_UseAlternateSegmentStyle = value;
|
||||
|
||||
OnPropertyChangedEx("UseAlternateSegmentStyle", 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 ((_AlternateSegmentStyle == null || _AlternateSegmentStyle.IsEmpty == true) &&
|
||||
(_DefaultSegmentStyle == null || _DefaultSegmentStyle.IsEmpty) &&
|
||||
(_ShowWhiskerCaps == Tbool.NotSet));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(ChartHiLoBarVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style._AlternateSegmentStyle != null && style._AlternateSegmentStyle.IsEmpty == false)
|
||||
AlternateSegmentStyle.ApplyStyle(style._AlternateSegmentStyle);
|
||||
|
||||
if (style._DefaultSegmentStyle != null && style._DefaultSegmentStyle.IsEmpty == false)
|
||||
DefaultSegmentStyle.ApplyStyle(style._DefaultSegmentStyle);
|
||||
|
||||
if (style.ShowWhiskerCaps != Tbool.NotSet)
|
||||
ShowWhiskerCaps = style.ShowWhiskerCaps;
|
||||
|
||||
if (style.UseAlternateSegmentStyle != Tbool.NotSet)
|
||||
UseAlternateSegmentStyle = style.UseAlternateSegmentStyle;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new ChartHiLoBarVisualStyle Copy()
|
||||
{
|
||||
ChartHiLoBarVisualStyle style = new ChartHiLoBarVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(ChartHiLoBarVisualStyle style)
|
||||
{
|
||||
base.CopyTo(style);
|
||||
|
||||
style.AlternateSegmentStyle = (_AlternateSegmentStyle != null) ? _AlternateSegmentStyle.Copy() : null;
|
||||
style.DefaultSegmentStyle = (_DefaultSegmentStyle != null) ? _DefaultSegmentStyle.Copy() : null;
|
||||
|
||||
style.ShowWhiskerCaps = _ShowWhiskerCaps;
|
||||
style.UseAlternateSegmentStyle = _UseAlternateSegmentStyle;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSerialData
|
||||
|
||||
internal override SerialElementCollection GetSerialData(string serialName)
|
||||
{
|
||||
SerialElementCollection sec = new SerialElementCollection();
|
||||
|
||||
if (serialName != null)
|
||||
{
|
||||
if (serialName.Equals("") == true)
|
||||
serialName = "ChartHiLoBarVisualStyle";
|
||||
|
||||
sec.AddStartElement(serialName);
|
||||
}
|
||||
|
||||
if (_DefaultSegmentStyle != null && _DefaultSegmentStyle.IsEmpty == false)
|
||||
sec.AddElement(_DefaultSegmentStyle.GetSerialData("DefaultSegmentStyle"));
|
||||
|
||||
if (_AlternateSegmentStyle != null && _AlternateSegmentStyle.IsEmpty == false)
|
||||
sec.AddElement(_AlternateSegmentStyle.GetSerialData("AlternateSegmentStyle"));
|
||||
|
||||
sec.AddValue("ShowWhiskerCaps", ShowWhiskerCaps, Tbool.NotSet);
|
||||
sec.AddValue("UseAlternateSegmentStyle", UseAlternateSegmentStyle, Tbool.NotSet);
|
||||
|
||||
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 "ShowWhiskerCaps":
|
||||
ShowWhiskerCaps = (Tbool)se.GetValueEnum(typeof(Tbool));
|
||||
break;
|
||||
|
||||
case "UseAlternateSegmentStyle":
|
||||
UseAlternateSegmentStyle = (Tbool)se.GetValueEnum(typeof(Tbool));
|
||||
break;
|
||||
|
||||
default:
|
||||
base.ProcessValue(se);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ProcessCollection
|
||||
|
||||
internal override void ProcessCollection(SerialElement se)
|
||||
{
|
||||
SerialElementCollection sec = se.Sec;
|
||||
|
||||
switch (se.Name)
|
||||
{
|
||||
case "DefaultSegmentStyle":
|
||||
sec.PutSerialData(DefaultSegmentStyle);
|
||||
break;
|
||||
|
||||
case "AlternateSegmentStyle":
|
||||
sec.PutSerialData(AlternateSegmentStyle);
|
||||
break;
|
||||
|
||||
default:
|
||||
base.ProcessCollection(se);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
AlternateSegmentStyle = null;
|
||||
DefaultSegmentStyle = null;
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,351 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
///<summary>
|
||||
/// ChartLegendVisualStyles
|
||||
///</summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class ChartLegendVisualStyles : VisualStyles<ChartLegendVisualStyle>
|
||||
{
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public ChartLegendVisualStyles Copy()
|
||||
{
|
||||
ChartLegendVisualStyles styles = new ChartLegendVisualStyles();
|
||||
|
||||
for (int i = 0; i < Styles.Length; i++)
|
||||
{
|
||||
ChartLegendVisualStyle vstyle = Styles[i];
|
||||
|
||||
if (vstyle != null)
|
||||
styles.Styles[i] = vstyle.Copy();
|
||||
}
|
||||
|
||||
return (styles);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the visual style of a Legend element.
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class ChartLegendVisualStyle : ContainerVisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private Tbool _EquallySpacedItems = Tbool.NotSet;
|
||||
|
||||
private int _HorizontalSpacing = -1;
|
||||
private int _VerticalSpacing = -1;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region EquallySpacedItems
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether the items in the Legend are equally spaced.
|
||||
/// </summary>
|
||||
[DefaultValue(Tbool.NotSet), Category("Appearance")]
|
||||
[Description("Indicates whether the items in the Legend are equally spaced.")]
|
||||
public Tbool EquallySpacedItems
|
||||
{
|
||||
get { return (_EquallySpacedItems); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _EquallySpacedItems)
|
||||
{
|
||||
_EquallySpacedItems = value;
|
||||
|
||||
OnPropertyChangedEx("EquallySpacedItems", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region HorizontalSpacing
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the horizontal spacing of the legend items.
|
||||
/// </summary>
|
||||
[DefaultValue(-1), Category("Appearance")]
|
||||
[Description("Indicates the horizontal spacing of the legend items.")]
|
||||
public int HorizontalSpacing
|
||||
{
|
||||
get { return (_HorizontalSpacing); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _HorizontalSpacing)
|
||||
{
|
||||
_HorizontalSpacing = value;
|
||||
|
||||
OnPropertyChangedEx("HorizontalSpacing", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region VerticalSpacing
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the vertical spacing of the legend items.
|
||||
/// </summary>
|
||||
[DefaultValue(-1), Category("Appearance")]
|
||||
[Description("Indicates the vertical spacing of the legend items.")]
|
||||
public int VerticalSpacing
|
||||
{
|
||||
get { return (_VerticalSpacing); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _VerticalSpacing)
|
||||
{
|
||||
_VerticalSpacing = value;
|
||||
|
||||
OnPropertyChangedEx("VerticalSpacing", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#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 ((_EquallySpacedItems == Tbool.NotSet) &&
|
||||
(_HorizontalSpacing == -1) &&
|
||||
(_VerticalSpacing == -1) &&
|
||||
(base.IsEmpty == true));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Hidden properties
|
||||
|
||||
#region Alignment
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the alignment of the text
|
||||
/// </summary>
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public new Alignment Alignment
|
||||
{
|
||||
get { return (base.Alignment); }
|
||||
set { base.Alignment = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region AllowWrap
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether text wrapping is permitted
|
||||
/// </summary>
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public new Tbool AllowWrap
|
||||
{
|
||||
get { return (base.AllowWrap); }
|
||||
set { base.AllowWrap = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Font
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the style Font
|
||||
/// </summary>
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public new Font Font
|
||||
{
|
||||
get { return (base.Font); }
|
||||
set { base.Font = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TextColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Text color
|
||||
/// </summary>
|
||||
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public new Color TextColor
|
||||
{
|
||||
get { return (base.TextColor); }
|
||||
set { base.TextColor = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(ChartLegendVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style.EquallySpacedItems != Tbool.NotSet)
|
||||
EquallySpacedItems = style.EquallySpacedItems;
|
||||
|
||||
if (style.HorizontalSpacing != -1)
|
||||
HorizontalSpacing = style.HorizontalSpacing;
|
||||
|
||||
if (style.VerticalSpacing != -1)
|
||||
VerticalSpacing = style.VerticalSpacing;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyDefaults
|
||||
|
||||
public override void ApplyDefaults()
|
||||
{
|
||||
base.ApplyDefaults();
|
||||
|
||||
if (VerticalSpacing < 0)
|
||||
VerticalSpacing = 2;
|
||||
|
||||
if (HorizontalSpacing < 0)
|
||||
HorizontalSpacing = 2;
|
||||
|
||||
if (BorderPattern == null)
|
||||
BorderPattern = new BorderPattern(LinePattern.Solid);
|
||||
|
||||
if (DropShadow.Enabled == Tbool.NotSet)
|
||||
DropShadow.Enabled = Tbool.False;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new ChartLegendVisualStyle Copy()
|
||||
{
|
||||
ChartLegendVisualStyle style = new ChartLegendVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(ChartLegendVisualStyle style)
|
||||
{
|
||||
base.CopyTo(style);
|
||||
|
||||
style.HorizontalSpacing = _HorizontalSpacing;
|
||||
style.EquallySpacedItems = _EquallySpacedItems;
|
||||
|
||||
style.VerticalSpacing = _VerticalSpacing;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSerialData
|
||||
|
||||
internal override SerialElementCollection GetSerialData(string serialName)
|
||||
{
|
||||
SerialElementCollection sec = new SerialElementCollection();
|
||||
|
||||
if (serialName != null)
|
||||
{
|
||||
if (serialName.Equals("") == true)
|
||||
serialName = "ChartLegendVisualStyle";
|
||||
|
||||
sec.AddStartElement(serialName);
|
||||
}
|
||||
|
||||
sec.AddValue("HorizontalSpacing", HorizontalSpacing, -1);
|
||||
sec.AddValue("EquallySpacedItems", EquallySpacedItems, Tbool.NotSet);
|
||||
sec.AddValue("VerticalSpacing", VerticalSpacing, -1);
|
||||
|
||||
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 "HorizontalSpacing":
|
||||
HorizontalSpacing = int.Parse(se.StringValue);
|
||||
break;
|
||||
|
||||
case "EquallySpacedItems":
|
||||
EquallySpacedItems = (Tbool)se.GetValueEnum(typeof(Tbool));
|
||||
break;
|
||||
|
||||
case "VerticalSpacing":
|
||||
VerticalSpacing = int.Parse(se.StringValue);
|
||||
break;
|
||||
|
||||
default:
|
||||
base.ProcessValue(se);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,517 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Design;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the visual style of a Chart Line
|
||||
/// </summary>
|
||||
[ToolboxItem(false), DesignTimeVisible(false)]
|
||||
[TypeConverter(typeof(BlankExpandableObjectConverter))]
|
||||
public class ChartLineVisualStyle : BaseVisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private Color _LineColor = Color.Empty;
|
||||
private LinePattern _LinePattern = LinePattern.NotSet;
|
||||
private int _LineWidth = -1;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region LineColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Line color.
|
||||
/// </summary>
|
||||
[Description("Indicates the Line color.")]
|
||||
public Color LineColor
|
||||
{
|
||||
get { return (_LineColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_LineColor != value)
|
||||
{
|
||||
_LineColor = value;
|
||||
|
||||
OnPropertyChangedEx("LineColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeLineColor()
|
||||
{
|
||||
return (_LineColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetLineColor()
|
||||
{
|
||||
LineColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region LinePattern
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the LinePattern.
|
||||
/// </summary>
|
||||
[DefaultValue(LinePattern.NotSet)]
|
||||
[Description("Indicates the LinePattern.")]
|
||||
public LinePattern LinePattern
|
||||
{
|
||||
get { return (_LinePattern); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_LinePattern != value)
|
||||
{
|
||||
_LinePattern = value;
|
||||
|
||||
OnPropertyChangedEx("LinePattern", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region LineWidth
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the line width.
|
||||
/// </summary>
|
||||
[DefaultValue(-1)]
|
||||
[Description("Indicates the line width")]
|
||||
public int LineWidth
|
||||
{
|
||||
get { return (_LineWidth); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_LineWidth != value)
|
||||
{
|
||||
_LineWidth = value;
|
||||
|
||||
OnPropertyChangedEx("LineWidth", 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 ((_LineColor.IsEmpty) &&
|
||||
(_LinePattern == LinePattern.NotSet) &&
|
||||
(_LineWidth < 0) &&
|
||||
(base.IsEmpty == true));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal properties
|
||||
|
||||
internal bool IsDisplayable
|
||||
{
|
||||
get
|
||||
{
|
||||
return (LineColor.IsEmpty == false &&
|
||||
LinePattern != LinePattern.None &&
|
||||
LineWidth > 0);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(ChartLineVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style.LineColor.IsEmpty == false)
|
||||
LineColor = style.LineColor;
|
||||
|
||||
if (style.LinePattern != LinePattern.NotSet)
|
||||
LinePattern = style.LinePattern;
|
||||
|
||||
if (style.LineWidth >= 0)
|
||||
LineWidth = style.LineWidth;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyDefaults
|
||||
|
||||
public override void ApplyDefaults()
|
||||
{
|
||||
if (LinePattern == LinePattern.NotSet)
|
||||
LinePattern = LinePattern.Solid;
|
||||
|
||||
if (LineWidth < 0)
|
||||
LineWidth = 1;
|
||||
|
||||
base.ApplyDefaults();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new ChartLineVisualStyle Copy()
|
||||
{
|
||||
ChartLineVisualStyle style = new ChartLineVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(ChartLineVisualStyle style)
|
||||
{
|
||||
base.CopyTo(style);
|
||||
|
||||
style.LineColor = _LineColor;
|
||||
style.LinePattern = _LinePattern;
|
||||
style.LineWidth = _LineWidth;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSerialData
|
||||
|
||||
internal override SerialElementCollection GetSerialData(string serialName)
|
||||
{
|
||||
SerialElementCollection sec = new SerialElementCollection();
|
||||
|
||||
if (serialName != null)
|
||||
{
|
||||
if (serialName.Equals("") == true)
|
||||
serialName = "ChartLineVisualStyle";
|
||||
|
||||
sec.AddStartElement(serialName);
|
||||
}
|
||||
|
||||
sec.AddValue("LineColor", LineColor, Color.Empty);
|
||||
sec.AddValue("LinePattern", LinePattern, LinePattern.NotSet);
|
||||
sec.AddValue("LineWidth", LineWidth, -1);
|
||||
|
||||
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 "LineColor":
|
||||
LineColor = se.GetValueColor();
|
||||
break;
|
||||
|
||||
case "LinePattern":
|
||||
LinePattern = (LinePattern)se.GetValueEnum(typeof(LinePattern));
|
||||
break;
|
||||
|
||||
case "LineWidth":
|
||||
LineWidth = int.Parse(se.StringValue);
|
||||
break;
|
||||
|
||||
default:
|
||||
base.ProcessValue(se);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the visual style of a Chart CapLine
|
||||
/// </summary>
|
||||
[ToolboxItem(false), DesignTimeVisible(false)]
|
||||
[TypeConverter(typeof(BlankExpandableObjectConverter))]
|
||||
public class ChartCapLineVisualStyle : ChartLineVisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private ChartLineCap _EndCap = ChartLineCap.NotSet;
|
||||
private ChartLineCap _StartCap = ChartLineCap.NotSet;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region EndCap
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the line EndCap.
|
||||
/// </summary>
|
||||
[DefaultValue(ChartLineCap.NotSet)]
|
||||
[Description("Indicates the line End Cap.")]
|
||||
public ChartLineCap EndCap
|
||||
{
|
||||
get { return (_EndCap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_EndCap != value)
|
||||
{
|
||||
_EndCap = value;
|
||||
|
||||
OnPropertyChangedEx("EndCap", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StartCap
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the line StartCap.
|
||||
/// </summary>
|
||||
[DefaultValue(ChartLineCap.NotSet)]
|
||||
[Description("Indicates the line Start Cap.")]
|
||||
public ChartLineCap StartCap
|
||||
{
|
||||
get { return (_StartCap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_StartCap != value)
|
||||
{
|
||||
_StartCap = value;
|
||||
|
||||
OnPropertyChangedEx("StartCap", 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 ((_EndCap == ChartLineCap.NotSet) &&
|
||||
(_StartCap == ChartLineCap.NotSet) &&
|
||||
(base.IsEmpty == true));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(ChartCapLineVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style.EndCap != ChartLineCap.NotSet)
|
||||
_EndCap = style.EndCap;
|
||||
|
||||
if (style.StartCap != ChartLineCap.NotSet)
|
||||
_StartCap = style.StartCap;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyDefaults
|
||||
|
||||
public override void ApplyDefaults()
|
||||
{
|
||||
if (EndCap == ChartLineCap.NotSet)
|
||||
EndCap = ChartLineCap.NoAnchor;
|
||||
|
||||
if (StartCap == ChartLineCap.NotSet)
|
||||
StartCap = ChartLineCap.NoAnchor;
|
||||
|
||||
base.ApplyDefaults();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new ChartCapLineVisualStyle Copy()
|
||||
{
|
||||
ChartCapLineVisualStyle style = new ChartCapLineVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(ChartCapLineVisualStyle style)
|
||||
{
|
||||
base.CopyTo(style);
|
||||
|
||||
style.EndCap = _EndCap;
|
||||
style.StartCap = _StartCap;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSerialData
|
||||
|
||||
internal override SerialElementCollection GetSerialData(string serialName)
|
||||
{
|
||||
SerialElementCollection sec = new SerialElementCollection();
|
||||
|
||||
if (serialName != null)
|
||||
{
|
||||
if (serialName.Equals("") == true)
|
||||
serialName = "ChartCapLineVisualStyle";
|
||||
|
||||
sec.AddStartElement(serialName);
|
||||
}
|
||||
|
||||
sec.AddValue("EndCap", EndCap, ChartLineCap.NotSet);
|
||||
sec.AddValue("StartCap", StartCap, ChartLineCap.NotSet);
|
||||
|
||||
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 "EndCap":
|
||||
EndCap = (ChartLineCap)se.GetValueEnum(typeof(ChartLineCap));
|
||||
break;
|
||||
|
||||
case "StartCap":
|
||||
StartCap = (ChartLineCap)se.GetValueEnum(typeof(ChartLineCap));
|
||||
break;
|
||||
|
||||
default:
|
||||
base.ProcessValue(se);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,357 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Design;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the visual style of a ChartPanel
|
||||
/// </summary>
|
||||
[ToolboxItem(false), DesignTimeVisible(false)]
|
||||
[TypeConverter(typeof(BlankExpandableObjectConverter))]
|
||||
public class ChartPanelVisualStyle : BaseVisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private DividerLineVisualStyle _DividerLineX;
|
||||
private DividerLineVisualStyle _DividerLineY;
|
||||
|
||||
private ScrollBarVisualStyles _HScrollBarVisualStyles;
|
||||
private ScrollBarVisualStyles _VScrollBarVisualStyles;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region DividerLineX
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual style of the horizontal DividerLine (when ChartMatrix.DividerLines is enabled).
|
||||
/// </summary>
|
||||
[Description("Indicates the visual style of the horizontal DividerLine (when ChartMatrix.DividerLines is enabled).")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public DividerLineVisualStyle DividerLineX
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_DividerLineX == null)
|
||||
{
|
||||
_DividerLineX = new DividerLineVisualStyle();
|
||||
|
||||
UpdateChangeHandler(null, _DividerLineX);
|
||||
}
|
||||
|
||||
return (_DividerLineX);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_DividerLineX != value)
|
||||
{
|
||||
UpdateChangeHandler(_DividerLineX, value);
|
||||
|
||||
_DividerLineX = value;
|
||||
|
||||
OnPropertyChangedEx("DividerLineX", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region DividerLineY
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual style of the vertical DividerLine (when ChartMatrix.DividerLines is enabled).
|
||||
/// </summary>
|
||||
[Description("Indicates the visual style of the vertical DividerLine. (when ChartMatrix.DividerLines is enabled)")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public DividerLineVisualStyle DividerLineY
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_DividerLineY == null)
|
||||
{
|
||||
_DividerLineY = new DividerLineVisualStyle();
|
||||
|
||||
UpdateChangeHandler(null, _DividerLineY);
|
||||
}
|
||||
|
||||
return (_DividerLineY);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_DividerLineY != value)
|
||||
{
|
||||
UpdateChangeHandler(_DividerLineY, value);
|
||||
|
||||
_DividerLineY = value;
|
||||
|
||||
OnPropertyChangedEx("DividerLineY", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region HScrollBarVisualStyles
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual styles to be used for Horizontal ScrollBar elements
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates visual styles to be used for Horizontal ScrollBar elements ")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public ScrollBarVisualStyles HScrollBarVisualStyles
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_HScrollBarVisualStyles == null)
|
||||
{
|
||||
_HScrollBarVisualStyles = new ScrollBarVisualStyles();
|
||||
|
||||
UpdateChangeHandler(null, _HScrollBarVisualStyles);
|
||||
}
|
||||
|
||||
return (_HScrollBarVisualStyles);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_HScrollBarVisualStyles != value)
|
||||
{
|
||||
ScrollBarVisualStyles oldValue = _HScrollBarVisualStyles;
|
||||
_HScrollBarVisualStyles = value;
|
||||
|
||||
OnStyleChanged("HScrollBarVisualStyles", oldValue, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region VScrollBarVisualStyles
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual styles to be used for Vertical ScrollBar elements
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates visual styles to be used for Vertical ScrollBar elements ")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public ScrollBarVisualStyles VScrollBarVisualStyles
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_VScrollBarVisualStyles == null)
|
||||
{
|
||||
_VScrollBarVisualStyles = new ScrollBarVisualStyles();
|
||||
|
||||
UpdateChangeHandler(null, _VScrollBarVisualStyles);
|
||||
}
|
||||
|
||||
return (_VScrollBarVisualStyles);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_VScrollBarVisualStyles != value)
|
||||
{
|
||||
ScrollBarVisualStyles oldValue = _VScrollBarVisualStyles;
|
||||
_VScrollBarVisualStyles = value;
|
||||
|
||||
OnStyleChanged("VScrollBarVisualStyles", oldValue, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#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 ((_DividerLineX == null || _DividerLineX.IsEmpty == true) &&
|
||||
(_DividerLineY == null || _DividerLineY.IsEmpty == true) &&
|
||||
(_HScrollBarVisualStyles == null) &&
|
||||
(_VScrollBarVisualStyles == null) &&
|
||||
(base.IsEmpty == true));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(ChartPanelVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style.DividerLineX != null)
|
||||
DividerLineX.ApplyStyle(style.DividerLineX);
|
||||
|
||||
if (style.DividerLineY != null)
|
||||
DividerLineY.ApplyStyle(style.DividerLineY);
|
||||
|
||||
if (style.HScrollBarVisualStyles != null)
|
||||
{
|
||||
for (int i = 0; i < style.HScrollBarVisualStyles.Styles.Length; i++)
|
||||
{
|
||||
if (style.HScrollBarVisualStyles.Styles[i] != null)
|
||||
HScrollBarVisualStyles.GetStyle(i).ApplyStyle(style.HScrollBarVisualStyles.Styles[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (style.VScrollBarVisualStyles != null)
|
||||
{
|
||||
for (int i = 0; i < style.VScrollBarVisualStyles.Styles.Length; i++)
|
||||
{
|
||||
if (style.VScrollBarVisualStyles.Styles[i] != null)
|
||||
VScrollBarVisualStyles.GetStyle(i).ApplyStyle(style.VScrollBarVisualStyles.Styles[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new ChartPanelVisualStyle Copy()
|
||||
{
|
||||
ChartPanelVisualStyle style = new ChartPanelVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(ChartPanelVisualStyle style)
|
||||
{
|
||||
base.CopyTo(style);
|
||||
|
||||
style.DividerLineX = (_DividerLineX != null) ? _DividerLineX.Copy() : null;
|
||||
style.DividerLineY = (_DividerLineY != null) ? _DividerLineY.Copy() : null;
|
||||
|
||||
style.HScrollBarVisualStyles = (_HScrollBarVisualStyles != null) ? _HScrollBarVisualStyles.Copy() : null;
|
||||
style.VScrollBarVisualStyles = (_VScrollBarVisualStyles != null) ? _VScrollBarVisualStyles.Copy() : null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSerialData
|
||||
|
||||
internal override SerialElementCollection GetSerialData(string serialName)
|
||||
{
|
||||
SerialElementCollection sec = new SerialElementCollection();
|
||||
|
||||
if (serialName != null)
|
||||
{
|
||||
if (serialName.Equals("") == true)
|
||||
serialName = "ChartPanelVisualStyle";
|
||||
|
||||
sec.AddStartElement(serialName);
|
||||
}
|
||||
|
||||
if (_DividerLineX != null && _DividerLineX.IsEmpty == false)
|
||||
sec.AddElement(_DividerLineX.GetSerialData("DividerLineX"));
|
||||
|
||||
if (_DividerLineY != null && _DividerLineY.IsEmpty == false)
|
||||
sec.AddElement(_DividerLineY.GetSerialData("DividerLineY"));
|
||||
|
||||
if (_HScrollBarVisualStyles != null && _HScrollBarVisualStyles.IsEmpty == false)
|
||||
sec.AddElement(_HScrollBarVisualStyles.GetSerialData("HScrollBarVisualStyles"));
|
||||
|
||||
if (_VScrollBarVisualStyles != null && _VScrollBarVisualStyles.IsEmpty == false)
|
||||
sec.AddElement(_VScrollBarVisualStyles.GetSerialData("VScrollBarVisualStyles"));
|
||||
|
||||
sec.AddElement(base.GetSerialData(null));
|
||||
|
||||
if (serialName != null)
|
||||
sec.AddEndElement(serialName);
|
||||
|
||||
return (sec);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PutSerialData
|
||||
|
||||
#region ProcessCollection
|
||||
|
||||
internal override void ProcessCollection(SerialElement se)
|
||||
{
|
||||
SerialElementCollection sec = se.Sec;
|
||||
|
||||
switch (se.Name)
|
||||
{
|
||||
case "DividerLineX":
|
||||
sec.PutSerialData(DividerLineX);
|
||||
break;
|
||||
|
||||
case "DividerLineY":
|
||||
sec.PutSerialData(DividerLineY);
|
||||
break;
|
||||
|
||||
case "HScrollBarVisualStyles":
|
||||
sec.PutSerialData(HScrollBarVisualStyles);
|
||||
break;
|
||||
|
||||
case "VScrollBarVisualStyles":
|
||||
sec.PutSerialData(VScrollBarVisualStyles);
|
||||
break;
|
||||
|
||||
default:
|
||||
base.ProcessCollection(se);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
DividerLineX = null;
|
||||
DividerLineY = null;
|
||||
HScrollBarVisualStyles = null;
|
||||
VScrollBarVisualStyles = null;
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,300 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the visual style of a Chart Ticmark element.
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(BlankExpandableObjectConverter))]
|
||||
public class ChartTickmarkVisualStyle : BaseVisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private int _TickmarkLength = -1;
|
||||
private int _TickmarkThickness = -1;
|
||||
private Color _TickmarkColor = Color.Empty;
|
||||
|
||||
private LineAlignment _TickmarkAlignment = LineAlignment.NotSet;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region TickmarkAlignment
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Tickmark alignment.
|
||||
/// </summary>
|
||||
[DefaultValue(LineAlignment.NotSet), Category("Appearance")]
|
||||
[Description("Indicates the Tickmark alignment.")]
|
||||
public LineAlignment TickmarkAlignment
|
||||
{
|
||||
get { return (_TickmarkAlignment); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _TickmarkAlignment)
|
||||
{
|
||||
_TickmarkAlignment = value;
|
||||
|
||||
OnPropertyChangedEx("TickMarkAlignment", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TickmarkColor
|
||||
|
||||
///<summary>
|
||||
/// Gets or sets the Tickmark Color.
|
||||
///</summary>
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates the Tickmark Color.")]
|
||||
public Color TickmarkColor
|
||||
{
|
||||
get { return (_TickmarkColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _TickmarkColor)
|
||||
{
|
||||
_TickmarkColor = value;
|
||||
|
||||
OnPropertyChangedEx("TickmarkColor", Style.VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public bool ShouldSerializeTickmarkColor()
|
||||
{
|
||||
return (_TickmarkColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public void ResetTickmarkColor()
|
||||
{
|
||||
TickmarkColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TickmarkLength
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Tickmark length.
|
||||
/// </summary>
|
||||
[DefaultValue(-1), Category("Appearance")]
|
||||
[Description("Indicates the Tickmark length.")]
|
||||
public int TickmarkLength
|
||||
{
|
||||
get { return (_TickmarkLength); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _TickmarkLength)
|
||||
{
|
||||
_TickmarkLength = value;
|
||||
|
||||
OnPropertyChangedEx("TickmarkLength", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TickmarkThickness
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Tickmark Thickness.
|
||||
/// </summary>
|
||||
[DefaultValue(-1), Category("Appearance")]
|
||||
[Description("Indicates the Tickmark Thickness.")]
|
||||
public int TickmarkThickness
|
||||
{
|
||||
get { return (_TickmarkThickness); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _TickmarkThickness)
|
||||
{
|
||||
_TickmarkThickness = value;
|
||||
|
||||
OnPropertyChangedEx("TickmarkThickness", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#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 ((_TickmarkAlignment == LineAlignment.NotSet) &&
|
||||
(_TickmarkColor.IsEmpty == true) &&
|
||||
(_TickmarkLength < 0) &&
|
||||
(_TickmarkThickness < 0) &&
|
||||
(base.IsEmpty == true));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(ChartTickmarkVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style.TickmarkAlignment != LineAlignment.NotSet)
|
||||
TickmarkAlignment = style.TickmarkAlignment;
|
||||
|
||||
if (style.TickmarkColor.IsEmpty == false)
|
||||
TickmarkColor = style.TickmarkColor;
|
||||
|
||||
if (style.TickmarkLength >= 0)
|
||||
TickmarkLength = style.TickmarkLength;
|
||||
|
||||
if (style.TickmarkThickness >= 0)
|
||||
TickmarkThickness = style.TickmarkThickness;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new ChartTickmarkVisualStyle Copy()
|
||||
{
|
||||
ChartTickmarkVisualStyle style = new ChartTickmarkVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(ChartTickmarkVisualStyle style)
|
||||
{
|
||||
base.CopyTo(style);
|
||||
|
||||
style.TickmarkAlignment = _TickmarkAlignment;
|
||||
style.TickmarkColor = _TickmarkColor;
|
||||
style.TickmarkLength = _TickmarkLength;
|
||||
style.TickmarkThickness = _TickmarkThickness;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSerialData
|
||||
|
||||
internal override SerialElementCollection GetSerialData(string serialName)
|
||||
{
|
||||
SerialElementCollection sec = new SerialElementCollection();
|
||||
|
||||
if (serialName != null)
|
||||
{
|
||||
if (serialName.Equals("") == true)
|
||||
serialName = "ChartTickmarkVisualStyle";
|
||||
|
||||
sec.AddStartElement(serialName);
|
||||
}
|
||||
|
||||
sec.AddValue("TickmarkAlignment", TickmarkAlignment, LineAlignment.NotSet);
|
||||
sec.AddValue("TickmarkColor", TickmarkColor, Color.Empty);
|
||||
sec.AddValue("TickmarkLength", TickmarkLength, -1);
|
||||
sec.AddValue("TickmarkThickness", TickmarkThickness, -1);
|
||||
|
||||
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 "TickmarkAlignment":
|
||||
TickmarkAlignment = (LineAlignment)se.GetValueEnum(typeof(LineAlignment));
|
||||
break;
|
||||
|
||||
case "TickmarkColor":
|
||||
TickmarkColor = se.GetValueColor();
|
||||
break;
|
||||
|
||||
case "TickmarkLength":
|
||||
TickmarkLength = int.Parse(se.StringValue);
|
||||
break;
|
||||
|
||||
case "TickmarkThickness":
|
||||
TickmarkThickness = int.Parse(se.StringValue);
|
||||
break;
|
||||
|
||||
default:
|
||||
base.ProcessValue(se);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,268 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the visual style of an element.
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class ChartTitleVisualStyle : ContainerVisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private int _MaxLineCount = -1;
|
||||
private Tbool _Stretch = Tbool.NotSet;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region MaxLineCount
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum number of Text lines.
|
||||
/// </summary>
|
||||
[DefaultValue(-1), Category("Appearance")]
|
||||
[Description("Indicates the maximum number of Text lines.")]
|
||||
public int MaxLineCount
|
||||
{
|
||||
get { return (_MaxLineCount); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _MaxLineCount)
|
||||
{
|
||||
_MaxLineCount = value;
|
||||
|
||||
OnPropertyChangedEx("MaxLineCount", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Stretch
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether text is 'stretched' to consume entire XyAlignment area.
|
||||
/// </summary>
|
||||
[DefaultValue(Tbool.NotSet), Category("Appearance")]
|
||||
[Description("Indicates whether text is 'stretched' to consume entire XyAlignment area.")]
|
||||
public Tbool Stretch
|
||||
{
|
||||
get { return (_Stretch); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Stretch != value)
|
||||
{
|
||||
_Stretch = value;
|
||||
|
||||
OnPropertyChangedEx("Stretch", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#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 ((_MaxLineCount < 0) &&
|
||||
(_Stretch == Tbool.NotSet) &&
|
||||
(base.IsEmpty == true));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(ChartTitleVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style.MaxLineCount > 0)
|
||||
_MaxLineCount = style.MaxLineCount;
|
||||
|
||||
if (style.Stretch != Tbool.NotSet)
|
||||
_Stretch = style.Stretch;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyDefaults
|
||||
|
||||
public override void ApplyDefaults()
|
||||
{
|
||||
base.ApplyDefaults();
|
||||
|
||||
if (TextColor.IsEmpty)
|
||||
TextColor = Color.Black;
|
||||
|
||||
if (MaxLineCount < 0)
|
||||
MaxLineCount = 3;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new ChartTitleVisualStyle Copy()
|
||||
{
|
||||
ChartTitleVisualStyle style = new ChartTitleVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(ChartTitleVisualStyle style)
|
||||
{
|
||||
base.CopyTo(style);
|
||||
|
||||
style.MaxLineCount = _MaxLineCount;
|
||||
style.Stretch = _Stretch;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSerialData
|
||||
|
||||
internal override SerialElementCollection GetSerialData(string serialName)
|
||||
{
|
||||
SerialElementCollection sec = new SerialElementCollection();
|
||||
|
||||
if (serialName != null)
|
||||
{
|
||||
if (serialName.Equals("") == true)
|
||||
serialName = "ChartTitleVisualStyle";
|
||||
|
||||
sec.AddStartElement(serialName);
|
||||
}
|
||||
|
||||
sec.AddValue("MaxLineCount", MaxLineCount, -1);
|
||||
sec.AddValue("Stretch", Stretch, Tbool.NotSet);
|
||||
|
||||
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 "MaxLineCount":
|
||||
MaxLineCount = int.Parse(se.StringValue);
|
||||
break;
|
||||
|
||||
case "Stretch":
|
||||
Stretch = (Tbool)se.GetValueEnum(typeof(Tbool));
|
||||
break;
|
||||
|
||||
default:
|
||||
base.ProcessValue(se);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region RotateDegrees
|
||||
|
||||
///<summary>
|
||||
/// Specifies the degrees to rotate the element.
|
||||
///</summary>
|
||||
public enum RotateDegrees
|
||||
{
|
||||
///<summary>
|
||||
/// Not set
|
||||
///</summary>
|
||||
NotSet = -1,
|
||||
|
||||
///<summary>
|
||||
/// None
|
||||
///</summary>
|
||||
None,
|
||||
|
||||
///<summary>
|
||||
/// Rotate as needed
|
||||
///</summary>
|
||||
Auto,
|
||||
|
||||
///<summary>
|
||||
/// Rotate 90 degrees
|
||||
///</summary>
|
||||
Rotate90,
|
||||
|
||||
///<summary>
|
||||
/// Rotate 180 degrees
|
||||
///</summary>
|
||||
Rotate180,
|
||||
|
||||
///<summary>
|
||||
/// Rotate 270 degrees
|
||||
///</summary>
|
||||
Rotate270,
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
@@ -0,0 +1,398 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the visual style of an XY Chart element.
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(BlankExpandableObjectConverter))]
|
||||
public class ChartXyVisualStyle : ContainerVisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private ScrollBarVisualStyles _HScrollBarVisualStyles;
|
||||
private ScrollBarVisualStyles _VScrollBarVisualStyles;
|
||||
|
||||
private int _InterSeriesGap = -1;
|
||||
private int _IntraSeriesGap = -1;
|
||||
|
||||
private Tbool _AutoExpandIntraSeriesGap = Tbool.NotSet;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region AutoExpandIntraSeriesGap
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether to auto adjust the IntraSeriesGap when space permits.
|
||||
/// </summary>
|
||||
[Description("Indicates whether to auto adjust the IntraSeriesGap when space permits.")]
|
||||
[DefaultValue(Tbool.NotSet)]
|
||||
public Tbool AutoExpandIntraSeriesGap
|
||||
{
|
||||
get { return (_AutoExpandIntraSeriesGap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _AutoExpandIntraSeriesGap)
|
||||
{
|
||||
_AutoExpandIntraSeriesGap = value;
|
||||
|
||||
OnPropertyChangedEx("AutoExpandIntraSeriesGap", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region HScrollBarVisualStyles
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual styles to be used for Horizontal ScrollBar elements
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates visual styles to be used for Horizontal ScrollBar elements ")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public ScrollBarVisualStyles HScrollBarVisualStyles
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_HScrollBarVisualStyles == null)
|
||||
{
|
||||
_HScrollBarVisualStyles = new ScrollBarVisualStyles();
|
||||
|
||||
UpdateChangeHandler(null, _HScrollBarVisualStyles);
|
||||
}
|
||||
|
||||
return (_HScrollBarVisualStyles);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_HScrollBarVisualStyles != value)
|
||||
{
|
||||
ScrollBarVisualStyles oldValue = _HScrollBarVisualStyles;
|
||||
_HScrollBarVisualStyles = value;
|
||||
|
||||
OnStyleChanged("HScrollBarVisualStyles", oldValue, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InterSeriesGap
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the pixel gap between grouped, qualitative series.
|
||||
/// </summary>
|
||||
[Description("Indicates the pixel gap between grouped, qualitative series.")]
|
||||
[DefaultValue(-1)]
|
||||
public int InterSeriesGap
|
||||
{
|
||||
get { return (_InterSeriesGap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _InterSeriesGap)
|
||||
{
|
||||
_InterSeriesGap = value;
|
||||
|
||||
OnPropertyChangedEx("InterSeriesGap", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IntraSeriesGap
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the pixel gap between each series in a set of grouped, qualitative series.
|
||||
/// </summary>
|
||||
[Description("Indicates the pixel gap between each series in a set of grouped, qualitative series.")]
|
||||
[DefaultValue(-1)]
|
||||
public int IntraSeriesGap
|
||||
{
|
||||
get { return (_IntraSeriesGap); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _IntraSeriesGap)
|
||||
{
|
||||
_IntraSeriesGap = value;
|
||||
|
||||
OnPropertyChangedEx("IntraSeriesGap", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region VScrollBarVisualStyles
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual styles to be used for Vertical ScrollBar elements
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates visual styles to be used for Vertical ScrollBar elements ")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public ScrollBarVisualStyles VScrollBarVisualStyles
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_VScrollBarVisualStyles == null)
|
||||
{
|
||||
_VScrollBarVisualStyles = new ScrollBarVisualStyles();
|
||||
|
||||
UpdateChangeHandler(null, _VScrollBarVisualStyles);
|
||||
}
|
||||
|
||||
return (_VScrollBarVisualStyles);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_VScrollBarVisualStyles != value)
|
||||
{
|
||||
ScrollBarVisualStyles oldValue = _VScrollBarVisualStyles;
|
||||
_VScrollBarVisualStyles = value;
|
||||
|
||||
OnStyleChanged("VScrollBarVisualStyles", oldValue, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#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 ((_InterSeriesGap < 0) &&
|
||||
(_IntraSeriesGap < 0) &&
|
||||
(_VScrollBarVisualStyles == null) &&
|
||||
(base.IsEmpty == true));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(ChartXyVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style.AutoExpandIntraSeriesGap != Tbool.NotSet)
|
||||
_AutoExpandIntraSeriesGap = style.AutoExpandIntraSeriesGap;
|
||||
|
||||
if (style.InterSeriesGap >= 0)
|
||||
_InterSeriesGap = style.InterSeriesGap;
|
||||
|
||||
if (style.IntraSeriesGap >= 0)
|
||||
_IntraSeriesGap = style.IntraSeriesGap;
|
||||
|
||||
if (style.HScrollBarVisualStyles != null)
|
||||
{
|
||||
for (int i = 0; i < style.HScrollBarVisualStyles.Styles.Length; i++)
|
||||
{
|
||||
if (style.HScrollBarVisualStyles.Styles[i] != null)
|
||||
HScrollBarVisualStyles.GetStyle(i).ApplyStyle(style.HScrollBarVisualStyles.Styles[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (style.VScrollBarVisualStyles != null)
|
||||
{
|
||||
for (int i = 0; i < style.VScrollBarVisualStyles.Styles.Length; i++)
|
||||
{
|
||||
if (style.VScrollBarVisualStyles.Styles[i] != null)
|
||||
VScrollBarVisualStyles.GetStyle(i).ApplyStyle(style.VScrollBarVisualStyles.Styles[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyDefaults
|
||||
|
||||
public override void ApplyDefaults()
|
||||
{
|
||||
if (BorderPattern == null)
|
||||
BorderPattern = new BorderPattern(LinePattern.Solid);
|
||||
|
||||
if (InterSeriesGap < 0)
|
||||
InterSeriesGap = 2;
|
||||
|
||||
if (IntraSeriesGap < 0)
|
||||
IntraSeriesGap = 2;
|
||||
|
||||
if (AutoExpandIntraSeriesGap == Tbool.NotSet)
|
||||
AutoExpandIntraSeriesGap = Tbool.True;
|
||||
|
||||
if (DropShadow.Enabled == Tbool.NotSet)
|
||||
DropShadow.Enabled = Tbool.False;
|
||||
|
||||
base.ApplyDefaults();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new ChartXyVisualStyle Copy()
|
||||
{
|
||||
ChartXyVisualStyle style = new ChartXyVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(ChartXyVisualStyle style)
|
||||
{
|
||||
base.CopyTo(style);
|
||||
|
||||
style.AutoExpandIntraSeriesGap = _AutoExpandIntraSeriesGap;
|
||||
style.InterSeriesGap = _InterSeriesGap;
|
||||
style.IntraSeriesGap = _IntraSeriesGap;
|
||||
|
||||
style.HScrollBarVisualStyles = (_HScrollBarVisualStyles != null) ? _HScrollBarVisualStyles.Copy() : null;
|
||||
style.VScrollBarVisualStyles = (_VScrollBarVisualStyles != null) ? _VScrollBarVisualStyles.Copy() : null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSerialData
|
||||
|
||||
internal override SerialElementCollection GetSerialData(string serialName)
|
||||
{
|
||||
SerialElementCollection sec = new SerialElementCollection();
|
||||
|
||||
if (serialName != null)
|
||||
{
|
||||
if (serialName.Equals("") == true)
|
||||
serialName = "ChartXyVisualStyle";
|
||||
|
||||
sec.AddStartElement(serialName);
|
||||
}
|
||||
|
||||
sec.AddValue("AutoExpandIntraSeriesGap", AutoExpandIntraSeriesGap, Tbool.NotSet);
|
||||
sec.AddValue("InterSeriesGap", InterSeriesGap, -1);
|
||||
sec.AddValue("IntraSeriesGap", IntraSeriesGap, -1);
|
||||
|
||||
if (_HScrollBarVisualStyles != null && _HScrollBarVisualStyles.IsEmpty == false)
|
||||
sec.AddElement(_HScrollBarVisualStyles.GetSerialData("HScrollBarVisualStyles"));
|
||||
|
||||
if (_VScrollBarVisualStyles != null && _VScrollBarVisualStyles.IsEmpty == false)
|
||||
sec.AddElement(_VScrollBarVisualStyles.GetSerialData("VScrollBarVisualStyles"));
|
||||
|
||||
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 "AutoExpandIntraSeriesGap":
|
||||
AutoExpandIntraSeriesGap = (Tbool)se.GetValueEnum(typeof(Tbool));
|
||||
break;
|
||||
|
||||
case "InterSeriesGap":
|
||||
InterSeriesGap = int.Parse(se.StringValue);
|
||||
break;
|
||||
|
||||
case "IntraSeriesGap":
|
||||
IntraSeriesGap = 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)
|
||||
{
|
||||
case "HScrollBarVisualStyles":
|
||||
sec.PutSerialData(HScrollBarVisualStyles);
|
||||
break;
|
||||
|
||||
case "VScrollBarVisualStyles":
|
||||
sec.PutSerialData(HScrollBarVisualStyles);
|
||||
break;
|
||||
|
||||
default:
|
||||
base.ProcessCollection(se);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
HScrollBarVisualStyles = null;
|
||||
VScrollBarVisualStyles = null;
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,407 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Design;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the visual style of a Chart Line
|
||||
/// </summary>
|
||||
[ToolboxItem(false), DesignTimeVisible(false)]
|
||||
[TypeConverter(typeof(DefaultStyleConvertor))]
|
||||
public class ConnectorLineVisualStyle : ChartLineVisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private int _MaxLength = -1;
|
||||
private int _MinLength = -1;
|
||||
private int _LengthStep = -1;
|
||||
|
||||
private int _DefaultAngle = -1;
|
||||
private int _AngleStep = -1;
|
||||
|
||||
private ConnectorOrigin _Origin = ConnectorOrigin.NotSet;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region AngleStep
|
||||
|
||||
///<summary>
|
||||
/// Gets or sets the angle step value when rotating conflicting labels.
|
||||
///</summary>
|
||||
[DefaultValue(-1), Category("DataLabel")]
|
||||
[Description("Indicates the angle step value when rotating conflicting labels.")]
|
||||
public int AngleStep
|
||||
{
|
||||
get { return (_AngleStep); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _AngleStep)
|
||||
{
|
||||
_AngleStep = value;
|
||||
|
||||
OnPropertyChangedEx("AngleStep", Style.VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region DefaultAngle
|
||||
|
||||
///<summary>
|
||||
/// Gets or sets the default line angle (-1 denotes 'auto').
|
||||
///</summary>
|
||||
[DefaultValue(-1), Category("DataLabel")]
|
||||
[Description("Indicates the default line angle (-1 denotes 'auto').")]
|
||||
public int DefaultAngle
|
||||
{
|
||||
get { return (_DefaultAngle); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _DefaultAngle)
|
||||
{
|
||||
_DefaultAngle = value;
|
||||
|
||||
OnPropertyChangedEx("DefaultAngle", Style.VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region LengthStep
|
||||
|
||||
///<summary>
|
||||
/// Gets or sets the angle step value when rotating conflicting labels.
|
||||
///</summary>
|
||||
[DefaultValue(-1), Category("DataLabel")]
|
||||
[Description("Indicates the angle step value when rotating conflicting labels.")]
|
||||
public int LengthStep
|
||||
{
|
||||
get { return (_LengthStep); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _LengthStep)
|
||||
{
|
||||
_LengthStep = value;
|
||||
|
||||
OnPropertyChangedEx("LengthStep", Style.VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region MaxLength
|
||||
|
||||
///<summary>
|
||||
/// Gets or sets the maximum connector line length.
|
||||
///</summary>
|
||||
[DefaultValue(-1), Category("DataLabel")]
|
||||
[Description("Indicates the maximum connector line length.")]
|
||||
public int MaxLength
|
||||
{
|
||||
get { return (_MaxLength); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _MaxLength)
|
||||
{
|
||||
_MaxLength = value;
|
||||
|
||||
OnPropertyChangedEx("MaxLength", Style.VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region MinLength
|
||||
|
||||
///<summary>
|
||||
/// Gets or sets the minimum connector line length.
|
||||
///</summary>
|
||||
[DefaultValue(-1), Category("DataLabel")]
|
||||
[Description("Indicates the minimum connector line length.")]
|
||||
public int MinLength
|
||||
{
|
||||
get { return (_MinLength); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _MinLength)
|
||||
{
|
||||
_MinLength = value;
|
||||
|
||||
OnPropertyChangedEx("MinLength", Style.VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Origin
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the line connector origin.
|
||||
/// </summary>
|
||||
[DefaultValue(ConnectorOrigin.NotSet)]
|
||||
[Description("Indicates the line connector origin")]
|
||||
public ConnectorOrigin Origin
|
||||
{
|
||||
get { return (_Origin); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _Origin)
|
||||
{
|
||||
_Origin = value;
|
||||
|
||||
OnPropertyChangedEx("Origin", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#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 ((_AngleStep < 0) &&
|
||||
(_DefaultAngle < 0) &&
|
||||
(_Origin == ConnectorOrigin.NotSet) &&
|
||||
(_LengthStep < 0) &&
|
||||
(_MaxLength < 0) &&
|
||||
(_MinLength < 0) &&
|
||||
(base.IsEmpty == true));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(ConnectorLineVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style.AngleStep >= 0)
|
||||
_AngleStep = style.AngleStep;
|
||||
|
||||
if (style.DefaultAngle >= 0)
|
||||
_DefaultAngle = style.DefaultAngle;
|
||||
|
||||
if (style.LengthStep >= 0)
|
||||
_LengthStep = style.LengthStep;
|
||||
|
||||
if (style.MaxLength >= 0)
|
||||
_MaxLength = style.MaxLength;
|
||||
|
||||
if (style.MinLength >= 0)
|
||||
_MinLength = style.MinLength;
|
||||
|
||||
if (style.Origin != ConnectorOrigin.NotSet)
|
||||
_Origin = style.Origin;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyDefaults
|
||||
|
||||
public override void ApplyDefaults()
|
||||
{
|
||||
if (MinLength > MaxLength)
|
||||
MaxLength = MinLength;
|
||||
|
||||
if (MinLength < 0)
|
||||
MinLength = 10;
|
||||
|
||||
if (MaxLength < 0)
|
||||
MaxLength = 200;
|
||||
|
||||
if (MaxLength <= MinLength)
|
||||
MaxLength = MinLength + 200;
|
||||
|
||||
if (AngleStep < 0)
|
||||
AngleStep = 15;
|
||||
|
||||
if (LengthStep < 0)
|
||||
LengthStep = 10;
|
||||
|
||||
if (LinePattern == LinePattern.NotSet)
|
||||
LinePattern = LinePattern.Solid;
|
||||
|
||||
if (LineColor.IsEmpty == true)
|
||||
LineColor = Color.Black;
|
||||
|
||||
if (LineWidth < 0)
|
||||
LineWidth = 1;
|
||||
|
||||
base.ApplyDefaults();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new ConnectorLineVisualStyle Copy()
|
||||
{
|
||||
ConnectorLineVisualStyle style = new ConnectorLineVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(ConnectorLineVisualStyle style)
|
||||
{
|
||||
base.CopyTo(style);
|
||||
|
||||
style.AngleStep = _AngleStep;
|
||||
style.DefaultAngle = _DefaultAngle;
|
||||
|
||||
style.LengthStep = _LengthStep;
|
||||
style.MaxLength = _MaxLength;
|
||||
style.MinLength = _MinLength;
|
||||
|
||||
style.Origin = _Origin;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSerialData
|
||||
|
||||
internal override SerialElementCollection GetSerialData(string serialName)
|
||||
{
|
||||
SerialElementCollection sec = new SerialElementCollection();
|
||||
|
||||
if (serialName != null)
|
||||
{
|
||||
if (serialName.Equals("") == true)
|
||||
serialName = "ConnectorLineVisualStyle";
|
||||
|
||||
sec.AddStartElement(serialName);
|
||||
}
|
||||
|
||||
sec.AddValue("AngleStep", AngleStep, -1);
|
||||
sec.AddValue("DefaultAngle", DefaultAngle, -1);
|
||||
|
||||
sec.AddValue("LengthStep", LengthStep, -1);
|
||||
sec.AddValue("MaxLength", MaxLength, -1);
|
||||
sec.AddValue("MinLength", MinLength, -1);
|
||||
|
||||
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 "AngleStep":
|
||||
AngleStep = int.Parse(se.StringValue);
|
||||
break;
|
||||
|
||||
case "DefaultAngle":
|
||||
DefaultAngle = int.Parse(se.StringValue);
|
||||
break;
|
||||
|
||||
case "LengthStep":
|
||||
LengthStep = int.Parse(se.StringValue);
|
||||
break;
|
||||
|
||||
case "MaxLength":
|
||||
MaxLength = int.Parse(se.StringValue);
|
||||
break;
|
||||
|
||||
case "MinLength":
|
||||
MinLength = int.Parse(se.StringValue);
|
||||
break;
|
||||
|
||||
default:
|
||||
base.ProcessValue(se);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region Enums
|
||||
|
||||
#region ConnectorOrigin
|
||||
|
||||
public enum ConnectorOrigin
|
||||
{
|
||||
NotSet = -1,
|
||||
|
||||
Center,
|
||||
|
||||
Edge,
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,269 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the visual style of an element.
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class CrosshairValueVisualStyle : VisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private string _TextFormat;
|
||||
private DropShadowVisualStyle _DropShadow;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#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 TextFormat
|
||||
|
||||
/// <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 ((_DropShadow == null || _DropShadow.IsEmpty) &&
|
||||
(string.IsNullOrEmpty(_TextFormat) == true) &&
|
||||
(base.IsEmpty == true));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(CrosshairValueVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style._DropShadow != null && style.DropShadow.IsEmpty == false)
|
||||
DropShadow.ApplyStyle(style.DropShadow);
|
||||
|
||||
if (string.IsNullOrEmpty(style.TextFormat) == false)
|
||||
_TextFormat = style.TextFormat;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyDefaults
|
||||
|
||||
public override void ApplyDefaults()
|
||||
{
|
||||
if (Background.IsEmpty == true)
|
||||
Background = new Background(ControlPaint.LightLight(Color.Fuchsia));
|
||||
|
||||
if (BorderColor.IsEmpty == true)
|
||||
BorderColor = new BorderColor(Color.Black);
|
||||
|
||||
if (BorderPattern.IsEmpty == true)
|
||||
BorderPattern = new BorderPattern(LinePattern.Solid);
|
||||
|
||||
if (BorderThickness.IsEmpty == true)
|
||||
BorderThickness = new Thickness(1);
|
||||
|
||||
base.ApplyDefaults();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new CrosshairValueVisualStyle Copy()
|
||||
{
|
||||
CrosshairValueVisualStyle style = new CrosshairValueVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(CrosshairValueVisualStyle style)
|
||||
{
|
||||
base.CopyTo(style);
|
||||
|
||||
style.DropShadow = (_DropShadow != null) ? DropShadow.Copy() : null;
|
||||
style.TextFormat = _TextFormat;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSerialData
|
||||
|
||||
internal override SerialElementCollection GetSerialData(string serialName)
|
||||
{
|
||||
SerialElementCollection sec = new SerialElementCollection();
|
||||
|
||||
if (serialName != null)
|
||||
{
|
||||
if (serialName.Equals("") == true)
|
||||
serialName = "CrosshairValueVisualStyle";
|
||||
|
||||
sec.AddStartElement(serialName);
|
||||
}
|
||||
|
||||
if (_DropShadow != null && _DropShadow.IsEmpty == false)
|
||||
sec.AddElement(_DropShadow.GetSerialData("DropShadow"));
|
||||
|
||||
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 "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 "DropShadow":
|
||||
sec.PutSerialData(DropShadow);
|
||||
break;
|
||||
|
||||
default:
|
||||
base.ProcessCollection(se);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
DropShadow = null;
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,778 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the visual style of an element.
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class CrosshairVisualStyle : BaseVisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private Background _Background;
|
||||
private Color _BorderColor = Color.Empty;
|
||||
private LinePattern _BorderPattern = LinePattern.NotSet;
|
||||
private int _BorderThickness;
|
||||
|
||||
private Color _TextColor = Color.Empty;
|
||||
|
||||
private ChartLineVisualStyle _ValueXLineStyle;
|
||||
private ChartLineVisualStyle _ValueYLineStyle;
|
||||
|
||||
private Font _GroupHeaderFont;
|
||||
private Color _GroupHeaderTextColor = Color.Empty;
|
||||
|
||||
private Font _Font;
|
||||
private Padding _Margin;
|
||||
private Padding _Padding;
|
||||
|
||||
#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 (_BorderColor != value)
|
||||
{
|
||||
_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 (_BorderPattern != value)
|
||||
{
|
||||
_BorderPattern = value;
|
||||
|
||||
OnPropertyChangedEx("BorderPattern", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BorderThickness
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the style border thickness.
|
||||
/// </summary>
|
||||
[DefaultValue(0)]
|
||||
[Description("Indicates the style border thickness")]
|
||||
public int BorderThickness
|
||||
{
|
||||
get { return (_BorderThickness); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_BorderThickness != value)
|
||||
{
|
||||
_BorderThickness = value;
|
||||
|
||||
OnPropertyChangedEx("BorderThickness", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GroupHeaderFont
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the GroupHeader Font
|
||||
/// </summary>
|
||||
[DefaultValue(null)]
|
||||
[Description("Indicates the GroupHeader Font")]
|
||||
public Font GroupHeaderFont
|
||||
{
|
||||
get { return (_GroupHeaderFont); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_GroupHeaderFont != value)
|
||||
{
|
||||
_GroupHeaderFont = value;
|
||||
|
||||
OnPropertyChangedEx("GroupHeaderFont", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GroupHeaderTextColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Color of the GroupHeaderText.
|
||||
/// </summary>
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates the Color of the GroupHeaderText.")]
|
||||
public Color GroupHeaderTextColor
|
||||
{
|
||||
get { return (_GroupHeaderTextColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_GroupHeaderTextColor != value)
|
||||
{
|
||||
_GroupHeaderTextColor = value;
|
||||
|
||||
OnPropertyChangedEx("GroupHeaderTextColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeGroupHeaderTextColor()
|
||||
{
|
||||
return (_GroupHeaderTextColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetGroupHeaderTextColor()
|
||||
{
|
||||
GroupHeaderTextColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Font
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Font
|
||||
/// </summary>
|
||||
[DefaultValue(null)]
|
||||
[Description("Indicates the Font")]
|
||||
public Font Font
|
||||
{
|
||||
get { return (_Font); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Font != value)
|
||||
{
|
||||
_Font = value;
|
||||
|
||||
OnPropertyChangedEx("Font", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Margin
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the spacing between the border and outside content.
|
||||
/// </summary>
|
||||
[Description("Indicates the spacing between the border and outside content")]
|
||||
public Padding Margin
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Margin == null)
|
||||
{
|
||||
_Margin = Padding.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _Margin);
|
||||
}
|
||||
|
||||
return (_Margin);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_Margin != value)
|
||||
{
|
||||
UpdateChangeHandler(_Margin, value);
|
||||
|
||||
_Margin = value;
|
||||
|
||||
OnPropertyChangedEx("Margin", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeMargin()
|
||||
{
|
||||
return (_Margin != null && _Margin.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetMargin()
|
||||
{
|
||||
Margin = null;
|
||||
}
|
||||
|
||||
#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.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <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 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 ValueXLineStyle
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual style for the X Value Line.
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates the visual style for the X Value Line.")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public ChartLineVisualStyle ValueXLineStyle
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_ValueXLineStyle == null)
|
||||
{
|
||||
_ValueXLineStyle = new ChartLineVisualStyle();
|
||||
|
||||
UpdateChangeHandler(null, _ValueXLineStyle);
|
||||
}
|
||||
|
||||
return (_ValueXLineStyle);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_ValueXLineStyle != value)
|
||||
{
|
||||
ChartLineVisualStyle oldValue = _ValueXLineStyle;
|
||||
|
||||
_ValueXLineStyle = value;
|
||||
|
||||
OnStyleChanged("ValueXLineStyle", oldValue, value);
|
||||
|
||||
if (oldValue != null)
|
||||
oldValue.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ValueYLineStyle
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual style for the Y Value Line.
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates the visual style for the Y Value Line.")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public ChartLineVisualStyle ValueYLineStyle
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_ValueYLineStyle == null)
|
||||
{
|
||||
_ValueYLineStyle = new ChartLineVisualStyle();
|
||||
|
||||
UpdateChangeHandler(null, _ValueYLineStyle);
|
||||
}
|
||||
|
||||
return (_ValueYLineStyle);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_ValueYLineStyle != value)
|
||||
{
|
||||
ChartLineVisualStyle oldValue = _ValueYLineStyle;
|
||||
|
||||
_ValueYLineStyle = value;
|
||||
|
||||
OnStyleChanged("ValueYLineStyle", oldValue, value);
|
||||
|
||||
if (oldValue != null)
|
||||
oldValue.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#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) &&
|
||||
(_GroupHeaderFont == null) &&
|
||||
(_Font == null) &&
|
||||
(_GroupHeaderTextColor.IsEmpty == true) &&
|
||||
(_Margin == null || _Margin.IsEmpty == true) &&
|
||||
(_Padding == null || _Padding.IsEmpty == true) &&
|
||||
(_TextColor.IsEmpty == true) &&
|
||||
(_ValueXLineStyle == null || _ValueXLineStyle.IsEmpty) &&
|
||||
(_ValueYLineStyle == null || _ValueYLineStyle.IsEmpty) &&
|
||||
(base.IsEmpty == true));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(CrosshairVisualStyle 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.GroupHeaderFont != null)
|
||||
GroupHeaderFont = style.GroupHeaderFont;
|
||||
|
||||
if (style._Font != null)
|
||||
Font = style.Font;
|
||||
|
||||
if (style.GroupHeaderTextColor.IsEmpty == false)
|
||||
GroupHeaderTextColor = style.GroupHeaderTextColor;
|
||||
|
||||
if (style._Margin != null && style._Margin.IsEmpty == false)
|
||||
Margin = style.Margin.Copy();
|
||||
|
||||
if (style._Padding != null && style._Padding.IsEmpty == false)
|
||||
Padding = style.Padding.Copy();
|
||||
|
||||
if (style._TextColor.IsEmpty == false)
|
||||
TextColor = style._TextColor;
|
||||
|
||||
if (style._ValueXLineStyle != null && style.ValueXLineStyle.IsEmpty == false)
|
||||
ValueXLineStyle.ApplyStyle(style.ValueXLineStyle);
|
||||
|
||||
if (style._ValueYLineStyle != null && style.ValueYLineStyle.IsEmpty == false)
|
||||
ValueYLineStyle.ApplyStyle(style.ValueYLineStyle);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new CrosshairVisualStyle Copy()
|
||||
{
|
||||
CrosshairVisualStyle style = new CrosshairVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(CrosshairVisualStyle style)
|
||||
{
|
||||
base.CopyTo(style);
|
||||
|
||||
style.Background = (_Background != null) ? _Background.Copy() : null;
|
||||
|
||||
style.BorderColor = _BorderColor;
|
||||
style.BorderPattern = _BorderPattern;
|
||||
style.BorderThickness = _BorderThickness;
|
||||
|
||||
style.GroupHeaderFont = (_GroupHeaderFont != null) ? (Font)_GroupHeaderFont.Clone() : null;
|
||||
style.GroupHeaderTextColor = _GroupHeaderTextColor;
|
||||
|
||||
style.Font = (_Font != null) ? (Font)_Font.Clone() : null;
|
||||
style.Margin = (_Margin != null) ? _Margin.Copy() : null;
|
||||
style.Padding = (_Padding != null) ? _Padding.Copy() : null;
|
||||
|
||||
style.TextColor = _TextColor;
|
||||
|
||||
style.ValueXLineStyle = (_ValueXLineStyle != null) ? _ValueXLineStyle.Copy() : null;
|
||||
style.ValueYLineStyle = (_ValueYLineStyle != null) ? _ValueYLineStyle.Copy() : null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSerialData
|
||||
|
||||
internal override SerialElementCollection GetSerialData(string serialName)
|
||||
{
|
||||
SerialElementCollection sec = new SerialElementCollection();
|
||||
|
||||
if (serialName != null)
|
||||
{
|
||||
if (serialName.Equals("") == true)
|
||||
serialName = "CrosshairVisualStyle";
|
||||
|
||||
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, 0);
|
||||
|
||||
if (_GroupHeaderFont != null)
|
||||
sec.AddValue("GroupHeaderFont", XmlSerializableFont.ConvertToString(GroupHeaderFont));
|
||||
|
||||
sec.AddValue("GroupHeaderTextColor", GroupHeaderTextColor, Color.Empty);
|
||||
|
||||
if (_Font != null)
|
||||
sec.AddValue("Font", XmlSerializableFont.ConvertToString(Font));
|
||||
|
||||
if (_Margin != null && _Margin.IsEmpty == false)
|
||||
sec.AddElement(_Margin.GetSerialData("Margin"));
|
||||
|
||||
if (_Padding != null && _Padding.IsEmpty == false)
|
||||
sec.AddElement(_Padding.GetSerialData("Padding"));
|
||||
|
||||
sec.AddValue("TextColor", TextColor, Color.Empty);
|
||||
|
||||
if (_ValueXLineStyle != null && _ValueXLineStyle.IsEmpty == false)
|
||||
sec.AddElement(_ValueXLineStyle.GetSerialData("ValueXLineStyle"));
|
||||
|
||||
if (_ValueYLineStyle != null && _ValueYLineStyle.IsEmpty == false)
|
||||
sec.AddElement(_ValueYLineStyle.GetSerialData("ValueYLineStyle"));
|
||||
|
||||
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 "GroupHeaderFont":
|
||||
GroupHeaderFont = XmlSerializableFont.ConvertFromString(se.StringValue);
|
||||
break;
|
||||
|
||||
case "GroupHeaderTextColor":
|
||||
GroupHeaderTextColor = se.GetValueColor();
|
||||
break;
|
||||
|
||||
case "Font":
|
||||
Font = XmlSerializableFont.ConvertFromString(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 "Margin":
|
||||
sec.PutSerialData(Margin);
|
||||
break;
|
||||
|
||||
case "Padding":
|
||||
sec.PutSerialData(Padding);
|
||||
break;
|
||||
|
||||
case "ValueXLineStyle":
|
||||
sec.PutSerialData(ValueXLineStyle);
|
||||
break;
|
||||
|
||||
case "ValueYLineStyle":
|
||||
sec.PutSerialData(ValueYLineStyle);
|
||||
break;
|
||||
|
||||
default:
|
||||
base.ProcessCollection(se);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
Margin = null;
|
||||
Padding = null;
|
||||
ValueXLineStyle = null;
|
||||
ValueYLineStyle = null;
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,56 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the visual style of a Legend element.
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class DividerLineVisualStyle : ChartLineVisualStyle
|
||||
{
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to the instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(DividerLineVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
base.ApplyStyle(style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new DividerLineVisualStyle Copy()
|
||||
{
|
||||
DividerLineVisualStyle style = new DividerLineVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(DividerLineVisualStyle style)
|
||||
{
|
||||
base.CopyTo(style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,309 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Design;
|
||||
using System.Globalization;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the visual style of a DropShadow
|
||||
/// </summary>
|
||||
[ToolboxItem(false), DesignTimeVisible(false)]
|
||||
[TypeConverter(typeof(DropShadowStyleConvertor))]
|
||||
public class DropShadowVisualStyle : BaseVisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private Tbool _Enabled = Tbool.NotSet;
|
||||
private Color _ShadowColor = Color.Empty;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region ShadowColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the DropShadow color
|
||||
/// </summary>
|
||||
[Description("Indicates the DropShadow color")]
|
||||
public Color ShadowColor
|
||||
{
|
||||
get { return (_ShadowColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _ShadowColor)
|
||||
{
|
||||
_ShadowColor = value;
|
||||
|
||||
OnPropertyChangedEx("ShadowColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeShadowColor()
|
||||
{
|
||||
return (_ShadowColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetShadowColor()
|
||||
{
|
||||
_ShadowColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Enabled
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether drop shadow is displayed.
|
||||
/// </summary>
|
||||
[DefaultValue(Tbool.NotSet), Category("Appearance")]
|
||||
[Description("Indicates whether drop shadow is displayed.")]
|
||||
public Tbool Enabled
|
||||
{
|
||||
get { return (_Enabled); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _Enabled)
|
||||
{
|
||||
_Enabled = value;
|
||||
|
||||
OnPropertyChangedEx("Enabled", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#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 ((_ShadowColor.IsEmpty == true) &&
|
||||
(_Enabled == Tbool.NotSet) &&
|
||||
(base.IsEmpty == true));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region RenderDropShadow
|
||||
|
||||
internal virtual void RenderDropShadow(
|
||||
Graphics g, Rectangle r, bool drawBot, bool drawRight)
|
||||
{
|
||||
Color color = (_ShadowColor.IsEmpty == false) ? _ShadowColor : Color.Black;
|
||||
|
||||
Point[] pts = new Point[]
|
||||
{
|
||||
new Point(r.X + 3, r.Bottom),
|
||||
new Point(r.Right, r.Bottom),
|
||||
new Point(r.Right, r.Y + 3)
|
||||
};
|
||||
|
||||
using (Pen pen1 = new Pen(Color.FromArgb(100, color)))
|
||||
g.DrawLines(pen1, pts);
|
||||
|
||||
IncShadowPts(pts);
|
||||
|
||||
using (Pen pen2 = new Pen(Color.FromArgb(64, color)))
|
||||
g.DrawLines(pen2, pts);
|
||||
|
||||
IncShadowPts(pts);
|
||||
|
||||
using (Pen pen3 = new Pen(Color.FromArgb(32, color)))
|
||||
g.DrawLines(pen3, pts);
|
||||
|
||||
IncShadowPts(pts);
|
||||
}
|
||||
|
||||
#region IncShadowPts
|
||||
|
||||
private void IncShadowPts(Point[] pts)
|
||||
{
|
||||
pts[0].X++;
|
||||
pts[0].Y++;
|
||||
|
||||
pts[1].X++;
|
||||
pts[1].Y++;
|
||||
|
||||
pts[2].X++;
|
||||
pts[2].Y++;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(DropShadowVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style.ShadowColor.IsEmpty == false)
|
||||
ShadowColor = style.ShadowColor;
|
||||
|
||||
if (style.Enabled != Tbool.NotSet)
|
||||
Enabled = style.Enabled;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new DropShadowVisualStyle Copy()
|
||||
{
|
||||
DropShadowVisualStyle style = new DropShadowVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(DropShadowVisualStyle style)
|
||||
{
|
||||
base.CopyTo(style);
|
||||
|
||||
style.Enabled = _Enabled;
|
||||
style.ShadowColor = _ShadowColor;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSerialData
|
||||
|
||||
internal override SerialElementCollection GetSerialData(string serialName)
|
||||
{
|
||||
SerialElementCollection sec = new SerialElementCollection();
|
||||
|
||||
if (serialName != null)
|
||||
{
|
||||
if (serialName.Equals("") == true)
|
||||
serialName = "DropShadowVisualStyle";
|
||||
|
||||
sec.AddStartElement(serialName);
|
||||
}
|
||||
|
||||
sec.AddValue("Enabled", Enabled, Tbool.NotSet);
|
||||
sec.AddValue("ShadowColor", ShadowColor, 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 "Enabled":
|
||||
Enabled = (Tbool)se.GetValueEnum(typeof(Tbool));
|
||||
break;
|
||||
|
||||
case "ShadowColor":
|
||||
ShadowColor = se.GetValueColor();
|
||||
break;
|
||||
|
||||
default:
|
||||
base.ProcessValue(se);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region DropShadowStyleConvertor
|
||||
|
||||
public class DropShadowStyleConvertor : ExpandableObjectConverter
|
||||
{
|
||||
public override object ConvertTo(
|
||||
ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
|
||||
{
|
||||
if (destinationType == typeof(string))
|
||||
{
|
||||
DropShadowVisualStyle dsc = value as DropShadowVisualStyle;
|
||||
|
||||
if (dsc != null)
|
||||
{
|
||||
ColorConverter cvt = new ColorConverter();
|
||||
|
||||
if (dsc.Enabled == Tbool.NotSet)
|
||||
return (" ");
|
||||
|
||||
return ((dsc.Enabled == Tbool.True) ? "Enabled" : "Disabled");
|
||||
}
|
||||
}
|
||||
|
||||
return (base.ConvertTo(context, culture, value, destinationType));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
@@ -0,0 +1,338 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using DevComponents.DotNetBar.Charts.Style;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides helpers when working with EffectiveStyles.
|
||||
/// </summary>
|
||||
public class EffectiveStyles<T> where T : BaseVisualStyle, new()
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private IEffectiveStyle _ChartElement;
|
||||
private VisualStyles<T> _Styles = new VisualStyles<T>();
|
||||
|
||||
private ushort[] _StyleUpdateCount;
|
||||
private ushort[] _GlobalStyleUpdateCount;
|
||||
|
||||
private List<BaseVisualStyle>[] _StyleList;
|
||||
|
||||
#endregion
|
||||
|
||||
public EffectiveStyles(IEffectiveStyle chartElement)
|
||||
{
|
||||
_ChartElement = chartElement;
|
||||
|
||||
int len = Enum.GetValues(typeof(StyleType)).Length - 1;
|
||||
|
||||
_StyleUpdateCount = new ushort[len];
|
||||
_GlobalStyleUpdateCount = new ushort[len];
|
||||
|
||||
_StyleList = new List<BaseVisualStyle>[len];
|
||||
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
_StyleUpdateCount[i] = ushort.MaxValue;
|
||||
_GlobalStyleUpdateCount[i] = ushort.MaxValue;
|
||||
}
|
||||
}
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region StyleType Indexer
|
||||
|
||||
public T this[StyleType type]
|
||||
{
|
||||
get { return (GetEffectiveStyle(type)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StyleState Indexer
|
||||
|
||||
public T this[StyleState state]
|
||||
{
|
||||
get { return (GetEffectiveStyle(state)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetEffectiveStyle
|
||||
|
||||
internal T GetEffectiveStyle(StyleType type)
|
||||
{
|
||||
return (GetStyle(type));
|
||||
}
|
||||
|
||||
internal T GetEffectiveStyle(StyleState state)
|
||||
{
|
||||
if (_ChartElement.ChartControl.DesignerHosted == true)
|
||||
state &= ~(StyleState.MouseOver | StyleState.Selected);
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case StyleState.MouseOver:
|
||||
return (GetStyle(StyleType.MouseOver));
|
||||
|
||||
case StyleState.Selected:
|
||||
return (GetStyle(StyleType.Selected));
|
||||
|
||||
case StyleState.Selected | StyleState.MouseOver:
|
||||
return (GetStyle(StyleType.SelectedMouseOver));
|
||||
|
||||
default:
|
||||
return (GetStyle(StyleType.Default));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetStyle
|
||||
|
||||
internal T GetStyle(StyleType e)
|
||||
{
|
||||
VisualStyles<T> cvs = _Styles;
|
||||
|
||||
if (cvs == null)
|
||||
cvs = new VisualStyles<T>();
|
||||
|
||||
int styleIndex = cvs.StyleIndex(e);
|
||||
|
||||
ushort styleUpdateCount = _StyleUpdateCount[styleIndex];
|
||||
ushort globalUpdateCount = _ChartElement.ChartControl.GlobalUpdateCount;
|
||||
|
||||
T style = cvs.Style(e);
|
||||
|
||||
if (_GlobalStyleUpdateCount[styleIndex] != globalUpdateCount)
|
||||
{
|
||||
if (style != null)
|
||||
styleUpdateCount = GetStyleUpdateCount(styleIndex);
|
||||
}
|
||||
|
||||
if (style == null || _StyleUpdateCount[styleIndex] != styleUpdateCount)
|
||||
{
|
||||
style = new T();
|
||||
|
||||
if (_StyleList[styleIndex] == null)
|
||||
_StyleList[styleIndex] = new List<BaseVisualStyle>();
|
||||
|
||||
_StyleList[styleIndex].Clear();
|
||||
|
||||
style.StyleType = e;
|
||||
style.StyleList = _StyleList[styleIndex];
|
||||
style.StyleUpdateMode = StyleUpdateMode.UpdateCount;
|
||||
|
||||
StyleType[] css = style.GetApplyStyleTypes(e);
|
||||
|
||||
if (css != null)
|
||||
{
|
||||
foreach (StyleType cs in css)
|
||||
_ChartElement.ApplyStyles(style, cs);
|
||||
}
|
||||
|
||||
style.StyleUpdateMode = StyleUpdateMode.None;
|
||||
|
||||
_ChartElement.ApplyDefaults(style, e);
|
||||
|
||||
style.StyleUpdateMode = (StyleUpdateMode.UpdateCount | StyleUpdateMode.Notify);
|
||||
|
||||
BaseVisualStyle vstyle = (BaseVisualStyle)style;
|
||||
_ChartElement.GetElementStyle(_ChartElement, e, ref vstyle);
|
||||
|
||||
_StyleUpdateCount[styleIndex] = GetStyleUpdateCount(styleIndex);
|
||||
|
||||
style.StyleList = null;
|
||||
|
||||
cvs[e] = style;
|
||||
|
||||
_Styles = cvs;
|
||||
}
|
||||
|
||||
_GlobalStyleUpdateCount[styleIndex] = globalUpdateCount;
|
||||
|
||||
return (cvs[e]);
|
||||
}
|
||||
|
||||
#region GetStyleUpdateCount
|
||||
|
||||
private ushort GetStyleUpdateCount(int styleIndex)
|
||||
{
|
||||
ushort styleCount = 0;
|
||||
|
||||
List<BaseVisualStyle> slist = _StyleList[styleIndex];
|
||||
|
||||
if (slist != null)
|
||||
{
|
||||
foreach (BaseVisualStyle style in slist)
|
||||
styleCount += style.StyleUpdateCount;
|
||||
}
|
||||
|
||||
return (styleCount);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InvalidateStyle
|
||||
|
||||
public bool InvalidateStyle(StyleType type)
|
||||
{
|
||||
if (_Styles != null)
|
||||
{
|
||||
if (_Styles[type] != null)
|
||||
{
|
||||
_Styles[type].Dispose();
|
||||
_Styles[type] = null;
|
||||
|
||||
return (true);
|
||||
}
|
||||
}
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region InvalidateStyles
|
||||
|
||||
public void InvalidateStyles()
|
||||
{
|
||||
if (_Styles != null)
|
||||
{
|
||||
_Styles.Dispose();
|
||||
_Styles = null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Provides helpers when working with EffectiveStyle.
|
||||
/// </summary>
|
||||
public class EffectiveStyle<T> where T : BaseVisualStyle, new()
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private IEffectiveStyle _ChartElement;
|
||||
private T _Style;
|
||||
|
||||
private ushort _StyleUpdateCount = ushort.MaxValue;
|
||||
private ushort _GlobalStyleUpdateCount = ushort.MaxValue;
|
||||
|
||||
private List<BaseVisualStyle> _StyleList = new List<BaseVisualStyle>();
|
||||
|
||||
#endregion
|
||||
|
||||
public EffectiveStyle(IEffectiveStyle chartElement)
|
||||
{
|
||||
_ChartElement = chartElement;
|
||||
}
|
||||
|
||||
#region Style
|
||||
|
||||
internal T Style
|
||||
{
|
||||
get
|
||||
{
|
||||
ushort styleUpdateCount = _StyleUpdateCount;
|
||||
ushort globalUpdateCount = _ChartElement.ChartControl.GlobalUpdateCount;
|
||||
|
||||
if (_GlobalStyleUpdateCount != globalUpdateCount)
|
||||
{
|
||||
if (_Style != null)
|
||||
styleUpdateCount = GetStyleUpdateCount();
|
||||
}
|
||||
|
||||
if (_Style == null || _StyleUpdateCount != styleUpdateCount)
|
||||
{
|
||||
T style = new T();
|
||||
|
||||
_StyleList.Clear();
|
||||
|
||||
style.StyleList = _StyleList;
|
||||
style.StyleType = StyleType.Default;
|
||||
|
||||
_ChartElement.ApplyStyles(style);
|
||||
_ChartElement.ApplyDefaults(style, StyleType.Default);
|
||||
|
||||
BaseVisualStyle vstyle = (BaseVisualStyle)style;
|
||||
_ChartElement.GetElementStyle(_ChartElement, StyleType.Default, ref vstyle);
|
||||
|
||||
_StyleUpdateCount = GetStyleUpdateCount();
|
||||
|
||||
style.StyleList = null;
|
||||
|
||||
_Style = style;
|
||||
}
|
||||
|
||||
_GlobalStyleUpdateCount = globalUpdateCount;
|
||||
|
||||
return (_Style);
|
||||
}
|
||||
}
|
||||
|
||||
#region GetStyleUpdateCount
|
||||
|
||||
private ushort GetStyleUpdateCount()
|
||||
{
|
||||
ushort styleCount = 0;
|
||||
|
||||
List<BaseVisualStyle> slist = _StyleList;
|
||||
|
||||
if (slist != null)
|
||||
{
|
||||
foreach (BaseVisualStyle style in slist)
|
||||
styleCount += style.StyleUpdateCount;
|
||||
}
|
||||
|
||||
return (styleCount);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region InvalidateStyle
|
||||
|
||||
public bool InvalidateStyle()
|
||||
{
|
||||
if (_Style != null)
|
||||
{
|
||||
_Style.Dispose();
|
||||
_Style = null;
|
||||
|
||||
return (true);
|
||||
}
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region IEffectiveStyle
|
||||
|
||||
public interface IEffectiveStyle
|
||||
{
|
||||
void ApplyStyles(BaseVisualStyle style);
|
||||
void ApplyStyles(BaseVisualStyle style, StyleType styleType);
|
||||
|
||||
void ApplyDefaults(BaseVisualStyle style, StyleType styleType);
|
||||
|
||||
void GetElementStyle(IEffectiveStyle chartElement, StyleType styleType, ref BaseVisualStyle style);
|
||||
|
||||
ChartControl ChartControl
|
||||
{
|
||||
get;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Design;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a GridLineVisualStyle.
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class GridLineVisualStyle : ChartLineVisualStyle
|
||||
{
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new GridLineVisualStyle Copy()
|
||||
{
|
||||
GridLineVisualStyle style = new GridLineVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(GridLineVisualStyle style)
|
||||
{
|
||||
base.CopyTo(style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,763 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents HiLoBarSegment visual style.
|
||||
/// </summary>
|
||||
[ToolboxItem(false), DesignTimeVisible(false)]
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class HiLoBarSegmentStyle : BaseVisualStyle
|
||||
{
|
||||
#region Static data
|
||||
|
||||
/// <summary>
|
||||
/// Returns Empty instance of HiLoBarSegmentStyle.
|
||||
/// </summary>
|
||||
public static HiLoBarSegmentStyle Empty
|
||||
{
|
||||
get { return (new HiLoBarSegmentStyle()); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private variables
|
||||
|
||||
private ChartLineVisualStyle _Default;
|
||||
|
||||
private ChartLineVisualStyle _OpenWhisker;
|
||||
private ChartLineVisualStyle _CloseWhisker;
|
||||
|
||||
private ChartLineVisualStyle _CenterLine;
|
||||
private ChartLineVisualStyle _MedianLine;
|
||||
|
||||
private ChartLineVisualStyle _HighWhisker;
|
||||
private ChartLineVisualStyle _LowWhisker;
|
||||
|
||||
private ChartLineVisualStyle _HighWhiskerCap;
|
||||
private ChartLineVisualStyle _LowWhiskerCap;
|
||||
|
||||
private Background _BoxBackground;
|
||||
private ChartLineVisualStyle _BoxBorder;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region BoxBackground
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual style for the Box Background (Box, Candle only).
|
||||
/// </summary>
|
||||
[Description("Indicates the the visual style for Box Background (Box, Candle only).")]
|
||||
public Background BoxBackground
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_BoxBackground == null)
|
||||
{
|
||||
_BoxBackground = Background.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _BoxBackground);
|
||||
}
|
||||
|
||||
return (_BoxBackground);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_BoxBackground != value)
|
||||
{
|
||||
Background oldValue = _BoxBackground;
|
||||
|
||||
_BoxBackground = value;
|
||||
|
||||
OnStyleChanged("BoxBackground", oldValue, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeBoxBackground()
|
||||
{
|
||||
return (_BoxBackground != null && _BoxBackground.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetBoxBackground()
|
||||
{
|
||||
BoxBackground = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BoxBorder
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual style for the Box Border (Box, Candle only).
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates the visual style for the Box Border (Box, Candle only).")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public ChartLineVisualStyle BoxBorder
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_BoxBorder == null)
|
||||
{
|
||||
_BoxBorder = new ChartLineVisualStyle();
|
||||
|
||||
UpdateChangeHandler(null, _BoxBorder);
|
||||
}
|
||||
|
||||
return (_BoxBorder);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_BoxBorder != value)
|
||||
{
|
||||
ChartLineVisualStyle oldValue = _BoxBorder;
|
||||
|
||||
_BoxBorder = value;
|
||||
|
||||
OnStyleChanged("BoxBorder", oldValue, value);
|
||||
|
||||
if (oldValue != null)
|
||||
oldValue.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CenterLine
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual style for the Center Line segment. This is the
|
||||
/// style used for the center Hilo segment and the Box/Candle segment when
|
||||
/// no Open or Close values are specified.
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates the visual style for the Center Line segment. This is the style used for the center Hilo segment and the Box/Candle segment when no Open or Close values are specified.")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public ChartLineVisualStyle CenterLine
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_CenterLine == null)
|
||||
{
|
||||
_CenterLine = new ChartLineVisualStyle();
|
||||
|
||||
UpdateChangeHandler(null, _CenterLine);
|
||||
}
|
||||
|
||||
return (_CenterLine);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_CenterLine != value)
|
||||
{
|
||||
ChartLineVisualStyle oldValue = _CenterLine;
|
||||
|
||||
_CenterLine = value;
|
||||
|
||||
OnStyleChanged("CenterLine", oldValue, value);
|
||||
|
||||
if (oldValue != null)
|
||||
oldValue.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CloseWhisker
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual style for the Close Whisker (Hilo only).
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates the visual style for the Close Whisker (Hilo only).")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public ChartLineVisualStyle CloseWhisker
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_CloseWhisker == null)
|
||||
{
|
||||
_CloseWhisker = new ChartLineVisualStyle();
|
||||
|
||||
UpdateChangeHandler(null, _CloseWhisker);
|
||||
}
|
||||
|
||||
return (_CloseWhisker);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_CloseWhisker != value)
|
||||
{
|
||||
ChartLineVisualStyle oldValue = _CloseWhisker;
|
||||
|
||||
_CloseWhisker = value;
|
||||
|
||||
OnStyleChanged("CloseWhisker", oldValue, value);
|
||||
|
||||
if (oldValue != null)
|
||||
oldValue.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Default
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual style used as the Default when
|
||||
/// a segment style is not specified (ie BoxBorder, HighWhisker, etc).
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates the visual style used as the Default when a segment style is not specified (ie BoxBorder, HighWhisker, etc).")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public ChartLineVisualStyle Default
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Default == null)
|
||||
{
|
||||
_Default = new ChartLineVisualStyle();
|
||||
|
||||
UpdateChangeHandler(null, _Default);
|
||||
}
|
||||
|
||||
return (_Default);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_Default != value)
|
||||
{
|
||||
ChartLineVisualStyle oldValue = _Default;
|
||||
|
||||
_Default = value;
|
||||
|
||||
OnStyleChanged("Default", oldValue, value);
|
||||
|
||||
if (oldValue != null)
|
||||
oldValue.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region HighWhisker
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual style for the High Whisker.
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates the visual style for the High Whisker.")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public ChartLineVisualStyle HighWhisker
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_HighWhisker == null)
|
||||
{
|
||||
_HighWhisker = new ChartLineVisualStyle();
|
||||
|
||||
UpdateChangeHandler(null, _HighWhisker);
|
||||
}
|
||||
|
||||
return (_HighWhisker);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_HighWhisker != value)
|
||||
{
|
||||
ChartLineVisualStyle oldValue = _HighWhisker;
|
||||
|
||||
_HighWhisker = value;
|
||||
|
||||
OnStyleChanged("HighWhisker", oldValue, value);
|
||||
|
||||
if (oldValue != null)
|
||||
oldValue.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region HighWhiskerCap
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual style for the High Whisker Cap.
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates the visual style for the High Whisker Cap.")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public ChartLineVisualStyle HighWhiskerCap
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_HighWhiskerCap == null)
|
||||
{
|
||||
_HighWhiskerCap = new ChartLineVisualStyle();
|
||||
|
||||
UpdateChangeHandler(null, _HighWhiskerCap);
|
||||
}
|
||||
|
||||
return (_HighWhiskerCap);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_HighWhiskerCap != value)
|
||||
{
|
||||
ChartLineVisualStyle oldValue = _HighWhiskerCap;
|
||||
|
||||
_HighWhiskerCap = value;
|
||||
|
||||
OnStyleChanged("HighWhiskerCap", oldValue, value);
|
||||
|
||||
if (oldValue != null)
|
||||
oldValue.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region LowWhisker
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual style for the Low Whisker.
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates the visual style for the Low Whisker.")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public ChartLineVisualStyle LowWhisker
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_LowWhisker == null)
|
||||
{
|
||||
_LowWhisker = new ChartLineVisualStyle();
|
||||
|
||||
UpdateChangeHandler(null, _LowWhisker);
|
||||
}
|
||||
|
||||
return (_LowWhisker);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_LowWhisker != value)
|
||||
{
|
||||
ChartLineVisualStyle oldValue = _LowWhisker;
|
||||
|
||||
_LowWhisker = value;
|
||||
|
||||
OnStyleChanged("LowWhisker", oldValue, value);
|
||||
|
||||
if (oldValue != null)
|
||||
oldValue.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region LowWhiskerCap
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual style for the Low Whisker Cap.
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates the visual style for the Low Whisker Cap.")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public ChartLineVisualStyle LowWhiskerCap
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_LowWhiskerCap == null)
|
||||
{
|
||||
_LowWhiskerCap = new ChartLineVisualStyle();
|
||||
|
||||
UpdateChangeHandler(null, _LowWhiskerCap);
|
||||
}
|
||||
|
||||
return (_LowWhiskerCap);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_LowWhiskerCap != value)
|
||||
{
|
||||
ChartLineVisualStyle oldValue = _LowWhiskerCap;
|
||||
|
||||
_LowWhiskerCap = value;
|
||||
|
||||
OnStyleChanged("LowWhiskerCap", oldValue, value);
|
||||
|
||||
if (oldValue != null)
|
||||
oldValue.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region MedianLine
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual style for the Median Line.
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates the visual style for the Median Line.")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public ChartLineVisualStyle MedianLine
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_MedianLine == null)
|
||||
{
|
||||
_MedianLine = new ChartLineVisualStyle();
|
||||
|
||||
UpdateChangeHandler(null, _MedianLine);
|
||||
}
|
||||
|
||||
return (_MedianLine);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_MedianLine != value)
|
||||
{
|
||||
ChartLineVisualStyle oldValue = _MedianLine;
|
||||
|
||||
_MedianLine = value;
|
||||
|
||||
OnStyleChanged("MedianLine", oldValue, value);
|
||||
|
||||
if (oldValue != null)
|
||||
oldValue.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region OpenWhisker
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual style for the Open Whisker (Hilo only).
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates the visual style for the Open Whisker (Hilo only).")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public ChartLineVisualStyle OpenWhisker
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_OpenWhisker == null)
|
||||
{
|
||||
_OpenWhisker = new ChartLineVisualStyle();
|
||||
|
||||
UpdateChangeHandler(null, _OpenWhisker);
|
||||
}
|
||||
|
||||
return (_OpenWhisker);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_OpenWhisker != value)
|
||||
{
|
||||
ChartLineVisualStyle oldValue = _OpenWhisker;
|
||||
|
||||
_OpenWhisker = value;
|
||||
|
||||
OnStyleChanged("OpenWhisker", oldValue, value);
|
||||
|
||||
if (oldValue != null)
|
||||
oldValue.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsEmpty
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether both colors assigned are empty.
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public override bool IsEmpty
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((_BoxBackground == null || _BoxBackground.IsEmpty) &&
|
||||
(_BoxBorder == null || _BoxBorder.IsEmpty) &&
|
||||
(_CenterLine == null || _CenterLine.IsEmpty) &&
|
||||
(_CloseWhisker == null || _CloseWhisker.IsEmpty) &&
|
||||
(_Default == null || _Default.IsEmpty) &&
|
||||
(_HighWhisker == null || _HighWhisker.IsEmpty) &&
|
||||
(_HighWhiskerCap == null || _HighWhiskerCap.IsEmpty) &&
|
||||
(_LowWhisker == null || _LowWhisker.IsEmpty) &&
|
||||
(_LowWhiskerCap == null || _LowWhiskerCap.IsEmpty) &&
|
||||
(_OpenWhisker == null || _OpenWhisker.IsEmpty) &&
|
||||
(_MedianLine == null || _MedianLine.IsEmpty) &&
|
||||
(base.IsEmpty == true));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(HiLoBarSegmentStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style._BoxBackground != null && style._BoxBackground.IsEmpty == false)
|
||||
BoxBackground = style._BoxBackground.Copy();
|
||||
|
||||
if (style._BoxBorder != null && style._BoxBorder.IsEmpty == false)
|
||||
BoxBorder.ApplyStyle(style._BoxBorder);
|
||||
|
||||
if (style._CenterLine != null && style._CenterLine.IsEmpty == false)
|
||||
CenterLine.ApplyStyle(style._CenterLine);
|
||||
|
||||
if (style._CloseWhisker != null && style._CloseWhisker.IsEmpty == false)
|
||||
CloseWhisker.ApplyStyle(style._CloseWhisker);
|
||||
|
||||
if (style._Default != null && style._Default.IsEmpty == false)
|
||||
Default.ApplyStyle(style._Default);
|
||||
|
||||
if (style._HighWhisker != null && style._HighWhisker.IsEmpty == false)
|
||||
HighWhisker.ApplyStyle(style._HighWhisker);
|
||||
|
||||
if (style._HighWhiskerCap != null && style._HighWhiskerCap.IsEmpty == false)
|
||||
HighWhiskerCap.ApplyStyle(style._HighWhiskerCap);
|
||||
|
||||
if (style._LowWhisker != null && style._LowWhisker.IsEmpty == false)
|
||||
LowWhisker.ApplyStyle(style._LowWhisker);
|
||||
|
||||
if (style._LowWhiskerCap != null && style._LowWhiskerCap.IsEmpty == false)
|
||||
LowWhiskerCap.ApplyStyle(style._LowWhiskerCap);
|
||||
|
||||
if (style._MedianLine != null && style._MedianLine.IsEmpty == false)
|
||||
MedianLine.ApplyStyle(style._MedianLine);
|
||||
|
||||
if (style._OpenWhisker != null && style._OpenWhisker.IsEmpty == false)
|
||||
OpenWhisker.ApplyStyle(style._OpenWhisker);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Creates an exact copy of the OhlcBarSegmentStyle.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the OhlcBarSegmentStyle.</returns>
|
||||
public new HiLoBarSegmentStyle Copy()
|
||||
{
|
||||
HiLoBarSegmentStyle style = new HiLoBarSegmentStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(HiLoBarSegmentStyle style)
|
||||
{
|
||||
style.BoxBackground = (_BoxBackground != null) ? _BoxBackground.Copy() : null;
|
||||
style.BoxBorder = (_BoxBorder != null) ? _BoxBorder.Copy() : null;
|
||||
style.CenterLine = (_CenterLine != null) ? _CenterLine.Copy() : null;
|
||||
style.CloseWhisker = (_CloseWhisker != null) ? _CloseWhisker.Copy() : null;
|
||||
style.Default = (_Default != null) ? _Default.Copy() : null;
|
||||
style.HighWhisker = (_HighWhisker != null) ? _HighWhisker.Copy() : null;
|
||||
style.HighWhiskerCap = (_HighWhiskerCap != null) ? _HighWhiskerCap.Copy() : null;
|
||||
style.LowWhisker = (_LowWhisker != null) ? _LowWhisker.Copy() : null;
|
||||
style.LowWhiskerCap = (_LowWhiskerCap != null) ? _LowWhiskerCap.Copy() : null;
|
||||
style.MedianLine = (_MedianLine != null) ? _MedianLine.Copy() : null;
|
||||
style.OpenWhisker = (_OpenWhisker != null) ? _OpenWhisker.Copy() : null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSerialData
|
||||
|
||||
internal override SerialElementCollection GetSerialData(string serialName)
|
||||
{
|
||||
SerialElementCollection sec = new SerialElementCollection();
|
||||
|
||||
if (serialName != null)
|
||||
{
|
||||
if (serialName.Equals("") == true)
|
||||
serialName = "HiLoBarSegmentStyle";
|
||||
|
||||
sec.AddStartElement(serialName);
|
||||
}
|
||||
|
||||
if (_BoxBackground != null && _BoxBackground.IsEmpty == false)
|
||||
sec.AddElement(_BoxBackground.GetSerialData("BoxBackground"));
|
||||
|
||||
if (_BoxBorder != null && _BoxBorder.IsEmpty == false)
|
||||
sec.AddElement(_BoxBorder.GetSerialData("BoxBorder"));
|
||||
|
||||
if (_CenterLine != null && _CenterLine.IsEmpty == false)
|
||||
sec.AddElement(_CenterLine.GetSerialData("CenterLine"));
|
||||
|
||||
if (_CloseWhisker != null && _CloseWhisker.IsEmpty == false)
|
||||
sec.AddElement(_CloseWhisker.GetSerialData("CloseWhisker"));
|
||||
|
||||
if (_Default != null && _Default.IsEmpty == false)
|
||||
sec.AddElement(_Default.GetSerialData("Default"));
|
||||
|
||||
if (_HighWhisker != null && _HighWhisker.IsEmpty == false)
|
||||
sec.AddElement(_HighWhisker.GetSerialData("HighWhisker"));
|
||||
|
||||
if (_HighWhiskerCap != null && _HighWhiskerCap.IsEmpty == false)
|
||||
sec.AddElement(_HighWhiskerCap.GetSerialData("HighWhiskerCap"));
|
||||
|
||||
if (_LowWhisker != null && _LowWhisker.IsEmpty == false)
|
||||
sec.AddElement(_LowWhisker.GetSerialData("LowWhisker"));
|
||||
|
||||
if (_LowWhiskerCap != null && _LowWhiskerCap.IsEmpty == false)
|
||||
sec.AddElement(_LowWhiskerCap.GetSerialData("LowWhiskerCap"));
|
||||
|
||||
if (_MedianLine != null && _MedianLine.IsEmpty == false)
|
||||
sec.AddElement(_MedianLine.GetSerialData("MedianLine"));
|
||||
|
||||
if (_OpenWhisker != null && _OpenWhisker.IsEmpty == false)
|
||||
sec.AddElement(_OpenWhisker.GetSerialData("OpenWhisker"));
|
||||
|
||||
sec.AddElement(base.GetSerialData(null));
|
||||
|
||||
if (serialName != null)
|
||||
sec.AddEndElement(serialName);
|
||||
|
||||
return (sec);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PutSerialData
|
||||
|
||||
#region ProcessCollection
|
||||
|
||||
internal override void ProcessCollection(SerialElement se)
|
||||
{
|
||||
SerialElementCollection sec = se.Sec;
|
||||
|
||||
switch (se.Name)
|
||||
{
|
||||
case "BoxBackground":
|
||||
sec.PutSerialData(BoxBackground);
|
||||
break;
|
||||
|
||||
case "BoxBorder":
|
||||
sec.PutSerialData(BoxBorder);
|
||||
break;
|
||||
|
||||
case "CenterLine":
|
||||
sec.PutSerialData(CenterLine);
|
||||
break;
|
||||
|
||||
case "CloseWhisker":
|
||||
sec.PutSerialData(CloseWhisker);
|
||||
break;
|
||||
|
||||
case "Default":
|
||||
sec.PutSerialData(Default);
|
||||
break;
|
||||
|
||||
case "HighWhisker":
|
||||
sec.PutSerialData(HighWhisker);
|
||||
break;
|
||||
|
||||
case "HighWhiskerCap":
|
||||
sec.PutSerialData(HighWhiskerCap);
|
||||
break;
|
||||
|
||||
case "LowWhisker":
|
||||
sec.PutSerialData(LowWhisker);
|
||||
break;
|
||||
|
||||
case "LowWhiskerCap":
|
||||
sec.PutSerialData(LowWhiskerCap);
|
||||
break;
|
||||
|
||||
case "MedianLine":
|
||||
sec.PutSerialData(MedianLine);
|
||||
break;
|
||||
|
||||
case "OpenWhisker":
|
||||
sec.PutSerialData(OpenWhisker);
|
||||
break;
|
||||
|
||||
default:
|
||||
base.ProcessCollection(se);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
BoxBorder = null;
|
||||
CenterLine = null;
|
||||
CloseWhisker = null;
|
||||
Default = null;
|
||||
HighWhisker = null;
|
||||
HighWhiskerCap = null;
|
||||
LowWhisker = null;
|
||||
LowWhiskerCap = null;
|
||||
MedianLine = null;
|
||||
OpenWhisker = null;
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,292 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
///<summary>
|
||||
/// Padding
|
||||
///</summary>
|
||||
[TypeConverter(typeof(PaddingTypeConverter))]
|
||||
public class Padding : Thickness
|
||||
{
|
||||
#region Static data
|
||||
|
||||
/// <summary>
|
||||
/// Returns Empty instance of Thickness.
|
||||
/// </summary>
|
||||
public new static Padding Empty
|
||||
{
|
||||
get { return (new Padding()); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Creates new instance of the class and initializes it.
|
||||
/// </summary>
|
||||
/// <param name="left">Left padding</param>
|
||||
/// <param name="right">Right padding</param>
|
||||
/// <param name="top">Top padding</param>
|
||||
/// <param name="bottom">Bottom padding</param>
|
||||
public Padding(int left, int top, int right, int bottom)
|
||||
: base(left, top, right, bottom)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the Padding class.
|
||||
/// </summary>
|
||||
/// <param name="all">Uniform padding.</param>
|
||||
public Padding(int all)
|
||||
: base(all)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the Padding class.
|
||||
/// </summary>
|
||||
public Padding()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Creates an exact copy of the Padding.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the Padding.</returns>
|
||||
public new Padding Copy()
|
||||
{
|
||||
Padding copy = new Padding(Left, Top, Right, Bottom);
|
||||
|
||||
return (copy);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSerialData
|
||||
|
||||
internal override SerialElementCollection GetSerialData(string name)
|
||||
{
|
||||
SerialElementCollection sec = new SerialElementCollection();
|
||||
|
||||
sec.AddStartElement(name);
|
||||
|
||||
if (IsUniform == true)
|
||||
{
|
||||
sec.AddValue("All", Left, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
sec.AddValue("Left", Left, 0);
|
||||
sec.AddValue("Top", Top, 0);
|
||||
sec.AddValue("Right", Right, 0);
|
||||
sec.AddValue("Bottom", Bottom, 0);
|
||||
}
|
||||
|
||||
sec.AddEndElement(name);
|
||||
|
||||
return (sec);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PutSerialData
|
||||
|
||||
#region ProcessValue
|
||||
|
||||
internal override void ProcessValue(SerialElement se)
|
||||
{
|
||||
switch (se.Name)
|
||||
{
|
||||
case "All":
|
||||
All = int.Parse(se.StringValue);
|
||||
break;
|
||||
|
||||
case "Left":
|
||||
Left = int.Parse(se.StringValue);
|
||||
break;
|
||||
|
||||
case "Top":
|
||||
Top = int.Parse(se.StringValue);
|
||||
break;
|
||||
|
||||
case "Right":
|
||||
Right = int.Parse(se.StringValue);
|
||||
break;
|
||||
|
||||
case "Bottom":
|
||||
Bottom = int.Parse(se.StringValue);
|
||||
break;
|
||||
|
||||
default:
|
||||
base.ProcessValue(se);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region PaddingTypeConverter
|
||||
|
||||
///<summary>
|
||||
/// PaddingTypeConverter
|
||||
///</summary>
|
||||
public class PaddingTypeConverter : ExpandableObjectConverter
|
||||
{
|
||||
#region CanConvertTo
|
||||
|
||||
/// <summary>
|
||||
/// CanConvertTo
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="destinationType"></param>
|
||||
/// <returns></returns>
|
||||
public override bool CanConvertTo(
|
||||
ITypeDescriptorContext context, Type destinationType)
|
||||
{
|
||||
if (destinationType == typeof(string))
|
||||
return (true);
|
||||
|
||||
return (base.CanConvertTo(context, destinationType));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ConvertTo
|
||||
|
||||
/// <summary>
|
||||
/// ConvertTo
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="culture"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="destinationType"></param>
|
||||
/// <returns></returns>
|
||||
public override object ConvertTo(
|
||||
ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
|
||||
{
|
||||
if (destinationType == typeof(string))
|
||||
{
|
||||
Padding p = value as Padding;
|
||||
|
||||
if (p != null)
|
||||
{
|
||||
if (p.IsUniform == true)
|
||||
return (p.Left.ToString());
|
||||
|
||||
return (String.Format("{0:d}, {1:d}, {2:d}, {3:d}",
|
||||
p.Bottom, p.Left, p.Right, p.Top));
|
||||
}
|
||||
}
|
||||
|
||||
return (base.ConvertTo(context, culture, value, destinationType));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CanConvertFrom
|
||||
|
||||
/// <summary>
|
||||
/// CanConvertFrom
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="sourceType"></param>
|
||||
/// <returns></returns>
|
||||
public override bool CanConvertFrom(
|
||||
ITypeDescriptorContext context, Type sourceType)
|
||||
{
|
||||
if (sourceType == typeof(string))
|
||||
return (true);
|
||||
|
||||
return (base.CanConvertFrom(context, sourceType));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ConvertFrom
|
||||
|
||||
/// <summary>
|
||||
/// ConvertFrom
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="culture"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public override object ConvertFrom(
|
||||
ITypeDescriptorContext context, CultureInfo culture, object value)
|
||||
{
|
||||
if (value is string)
|
||||
{
|
||||
string[] values = ((string)value).Split(',');
|
||||
|
||||
if (values.Length != 1 && values.Length != 4)
|
||||
throw new ArgumentException("Invalid value to convert.");
|
||||
|
||||
try
|
||||
{
|
||||
int[] v = new int[values.Length];
|
||||
|
||||
for (int i = 0; i < values.Length; i++)
|
||||
v[i] = int.Parse(values[i]);
|
||||
|
||||
Padding p = (values.Length == 1)
|
||||
? new Padding(v[0])
|
||||
: new Padding(v[1], v[3], v[2], v[0]);
|
||||
|
||||
return (p);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw new ArgumentException("Invalid value to convert.");
|
||||
}
|
||||
}
|
||||
|
||||
return base.ConvertFrom(context, culture, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetCreateInstanceSupported
|
||||
|
||||
/// <summary>
|
||||
/// GetCreateInstanceSupported
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <returns></returns>
|
||||
public override bool GetCreateInstanceSupported(ITypeDescriptorContext context)
|
||||
{
|
||||
return (true);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CreateInstance
|
||||
|
||||
/// <summary>
|
||||
/// CreateInstance
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="propertyValues"></param>
|
||||
/// <returns></returns>
|
||||
public override object CreateInstance(
|
||||
ITypeDescriptorContext context, IDictionary propertyValues)
|
||||
{
|
||||
return (new Padding((int)propertyValues["Left"], (int)propertyValues["Top"],
|
||||
(int)propertyValues["Right"], (int)propertyValues["Bottom"]));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,491 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
///<summary>
|
||||
/// PieChartVisualStyles
|
||||
///</summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class PieChartVisualStyles : VisualStyles<PieChartVisualStyle>
|
||||
{
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public PieChartVisualStyles Copy()
|
||||
{
|
||||
PieChartVisualStyles styles = new PieChartVisualStyles();
|
||||
|
||||
for (int i = 0; i < Styles.Length; i++)
|
||||
{
|
||||
PieChartVisualStyle vstyle = Styles[i];
|
||||
|
||||
if (vstyle != null)
|
||||
styles.Styles[i] = vstyle.Copy();
|
||||
}
|
||||
|
||||
return (styles);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the visual style of a Pie Chart element.
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(BlankExpandableObjectConverter))]
|
||||
public class PieChartVisualStyle : ContainerVisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private Background _AlternateGridBackground;
|
||||
|
||||
private PieGridLineVisualStyle _GridLineVisualStyle;
|
||||
private PieReferenceLineVisualStyle _ReferenceLineVisualStyle;
|
||||
private PieCenterVisualStyles _PieCenterVisualStyles;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region AlternateGridBackground
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the alternate, or interlaced, pie background (used
|
||||
/// when ShowPieGrid is enabled).
|
||||
/// </summary>
|
||||
[Description("Indicates the alternate, or interlaced, pie background (used when ShowPieGrid is enabled)")]
|
||||
public Background AlternateGridBackground
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_AlternateGridBackground == null)
|
||||
{
|
||||
_AlternateGridBackground = Background.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _AlternateGridBackground);
|
||||
}
|
||||
|
||||
return (_AlternateGridBackground);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_AlternateGridBackground != value)
|
||||
{
|
||||
UpdateChangeHandler(_AlternateGridBackground, value);
|
||||
|
||||
_AlternateGridBackground = value;
|
||||
|
||||
OnPropertyChangedEx("AlternateGridBackground", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeAlternateGridBackground()
|
||||
{
|
||||
return (_AlternateGridBackground != null && _AlternateGridBackground.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetAlternateGridBackground()
|
||||
{
|
||||
AlternateGridBackground = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GridLineVisualStyle
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual style to be used for GridLine elements.
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates visual style to be used for GridLine elements.")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public PieGridLineVisualStyle GridLineVisualStyle
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_GridLineVisualStyle == null)
|
||||
{
|
||||
_GridLineVisualStyle = new PieGridLineVisualStyle();
|
||||
|
||||
UpdateChangeHandler(null, _GridLineVisualStyle);
|
||||
}
|
||||
|
||||
return (_GridLineVisualStyle);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_GridLineVisualStyle != value)
|
||||
{
|
||||
PieGridLineVisualStyle oldValue = _GridLineVisualStyle;
|
||||
_GridLineVisualStyle = value;
|
||||
|
||||
OnStyleChanged("GridLinesVisualStyle", oldValue, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PieCenterVisualStyles
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual styles to be used for Pie Center elements.
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates visual styles to be used for Pie Center elements.")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public PieCenterVisualStyles PieCenterVisualStyles
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_PieCenterVisualStyles == null)
|
||||
{
|
||||
_PieCenterVisualStyles = new PieCenterVisualStyles();
|
||||
|
||||
UpdateChangeHandler(null, _PieCenterVisualStyles);
|
||||
UpdatePropertyHandler(null, _PieCenterVisualStyles);
|
||||
}
|
||||
|
||||
return (_PieCenterVisualStyles);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _PieCenterVisualStyles)
|
||||
{
|
||||
PieCenterVisualStyles oldValue = _PieCenterVisualStyles;
|
||||
_PieCenterVisualStyles = value;
|
||||
|
||||
OnStyleChanged("PieCenterVisualStyles", oldValue, value);
|
||||
|
||||
UpdatePropertyHandler(oldValue, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region UpdatePropertyHandler
|
||||
|
||||
protected void UpdatePropertyHandler(
|
||||
PieCenterVisualStyles oldValue, PieCenterVisualStyles newValue)
|
||||
{
|
||||
if (oldValue != null)
|
||||
{
|
||||
for (int i = 0; i < oldValue.Count; i++)
|
||||
{
|
||||
BaseVisualStyle style = oldValue[(StyleType)i];
|
||||
|
||||
style.PropertyChanged -= style_PropertyChanged;
|
||||
}
|
||||
}
|
||||
|
||||
if (newValue != null)
|
||||
{
|
||||
for (int i = 0; i < newValue.Count; i++)
|
||||
{
|
||||
BaseVisualStyle style = newValue[(StyleType)i];
|
||||
|
||||
style.PropertyChanged += style_PropertyChanged;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region style_PropertyChanged
|
||||
|
||||
void style_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
BaseVisualStyle style = sender as BaseVisualStyle;
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
style.StyleUpdateCount++;
|
||||
|
||||
BaseVisualStyle parent = style.Parent;
|
||||
|
||||
while (parent != null)
|
||||
{
|
||||
parent.StyleUpdateCount++;
|
||||
|
||||
parent = parent.Parent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ReferenceLineVisualStyle
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual style to be used for ReferenceLine elements
|
||||
/// </summary>
|
||||
[Category("Style")]
|
||||
[Description("Indicates visual style to be used for ReferenceLine elements ")]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public PieReferenceLineVisualStyle ReferenceLineVisualStyle
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_ReferenceLineVisualStyle == null)
|
||||
{
|
||||
_ReferenceLineVisualStyle = new PieReferenceLineVisualStyle();
|
||||
|
||||
UpdateChangeHandler(null, _ReferenceLineVisualStyle);
|
||||
}
|
||||
|
||||
return (_ReferenceLineVisualStyle);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_ReferenceLineVisualStyle != value)
|
||||
{
|
||||
PieReferenceLineVisualStyle oldValue = _ReferenceLineVisualStyle;
|
||||
_ReferenceLineVisualStyle = value;
|
||||
|
||||
OnStyleChanged("ReferenceLineVisualStyle", oldValue, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#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 ((_AlternateGridBackground == null || _AlternateGridBackground.IsEmpty) &&
|
||||
(_GridLineVisualStyle == null || _GridLineVisualStyle.IsEmpty) &&
|
||||
(_PieCenterVisualStyles == null || _PieCenterVisualStyles.IsEmpty) &&
|
||||
(_ReferenceLineVisualStyle == null || _ReferenceLineVisualStyle.IsEmpty) &&
|
||||
(base.IsEmpty == true));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(PieChartVisualStyle style)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
if (style._AlternateGridBackground != null && style.AlternateGridBackground.IsEmpty == false)
|
||||
AlternateGridBackground = style.AlternateGridBackground.Copy();
|
||||
|
||||
if (style._GridLineVisualStyle != null && style._GridLineVisualStyle.IsEmpty == false)
|
||||
GridLineVisualStyle.ApplyStyle(style.GridLineVisualStyle);
|
||||
|
||||
if (style._PieCenterVisualStyles != null)
|
||||
{
|
||||
for (int i = 0; i < style._PieCenterVisualStyles.Styles.Length; i++)
|
||||
{
|
||||
if (style._PieCenterVisualStyles.Styles[i] != null)
|
||||
PieCenterVisualStyles.GetStyle(i).ApplyStyle(style._PieCenterVisualStyles.Styles[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (style._ReferenceLineVisualStyle != null && style._ReferenceLineVisualStyle.IsEmpty == false)
|
||||
ReferenceLineVisualStyle.ApplyStyle(style._ReferenceLineVisualStyle);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyDefaults
|
||||
|
||||
public override void ApplyDefaults()
|
||||
{
|
||||
if (Alignment == Alignment.NotSet)
|
||||
Alignment = Alignment.MiddleCenter;
|
||||
|
||||
if (_AlternateGridBackground == null)
|
||||
AlternateGridBackground = new Background(Color.AliceBlue);
|
||||
|
||||
GridLineVisualStyle.ApplyDefaults();
|
||||
|
||||
if (_GridLineVisualStyle.LineColor.IsEmpty == true)
|
||||
GridLineVisualStyle.LineColor = Color.LightGray;
|
||||
|
||||
ReferenceLineVisualStyle.ApplyDefaults();
|
||||
|
||||
base.ApplyDefaults();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new PieChartVisualStyle Copy()
|
||||
{
|
||||
PieChartVisualStyle style = new PieChartVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(PieChartVisualStyle style)
|
||||
{
|
||||
base.CopyTo(style);
|
||||
|
||||
style.AlternateGridBackground = (_AlternateGridBackground != null) ? _AlternateGridBackground.Copy() : null;
|
||||
|
||||
style.GridLineVisualStyle = (_GridLineVisualStyle != null) ? _GridLineVisualStyle.Copy() : null;
|
||||
style.ReferenceLineVisualStyle = (_ReferenceLineVisualStyle != null) ? _ReferenceLineVisualStyle.Copy() : null;
|
||||
|
||||
style.PieCenterVisualStyles = (_PieCenterVisualStyles != null) ? _PieCenterVisualStyles.Copy() : null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSerialData
|
||||
|
||||
internal override SerialElementCollection GetSerialData(string serialName)
|
||||
{
|
||||
SerialElementCollection sec = new SerialElementCollection();
|
||||
|
||||
if (serialName != null)
|
||||
{
|
||||
if (serialName.Equals("") == true)
|
||||
serialName = "PieChartVisualStyle";
|
||||
|
||||
sec.AddStartElement(serialName);
|
||||
}
|
||||
|
||||
if (_AlternateGridBackground != null && _AlternateGridBackground.IsEmpty == false)
|
||||
sec.AddElement(_AlternateGridBackground.GetSerialData("AlternateBackground"));
|
||||
|
||||
if (_GridLineVisualStyle != null && _GridLineVisualStyle.IsEmpty == false)
|
||||
sec.AddElement(_GridLineVisualStyle.GetSerialData("GridLineVisualStyle"));
|
||||
|
||||
if (_PieCenterVisualStyles != null && _PieCenterVisualStyles.IsEmpty == false)
|
||||
sec.AddElement(_PieCenterVisualStyles.GetSerialData("PieCenterVisualStyles"));
|
||||
|
||||
if (_ReferenceLineVisualStyle != null && _ReferenceLineVisualStyle.IsEmpty == false)
|
||||
sec.AddElement(_ReferenceLineVisualStyle.GetSerialData("ReferenceLineVisualStyle"));
|
||||
|
||||
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)
|
||||
{
|
||||
default:
|
||||
base.ProcessValue(se);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ProcessCollection
|
||||
|
||||
internal override void ProcessCollection(SerialElement se)
|
||||
{
|
||||
SerialElementCollection sec = se.Sec;
|
||||
|
||||
switch (se.Name)
|
||||
{
|
||||
case "AlternateBackground":
|
||||
sec.PutSerialData(AlternateGridBackground);
|
||||
break;
|
||||
|
||||
case "GridLineVisualStyle":
|
||||
sec.PutSerialData(GridLineVisualStyle);
|
||||
break;
|
||||
|
||||
case "PieCenterVisualStyles":
|
||||
sec.PutSerialData(PieCenterVisualStyles);
|
||||
break;
|
||||
|
||||
case "ReferenceLineVisualStyle":
|
||||
sec.PutSerialData(ReferenceLineVisualStyle);
|
||||
break;
|
||||
|
||||
default:
|
||||
base.ProcessCollection(se);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
AlternateGridBackground = null;
|
||||
|
||||
GridLineVisualStyle = null;
|
||||
PieCenterVisualStyles = null;
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Design;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a PieGridLineVisualStyle.
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class PieGridLineVisualStyle : ChartLineVisualStyle
|
||||
{
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new PieGridLineVisualStyle Copy()
|
||||
{
|
||||
PieGridLineVisualStyle style = new PieGridLineVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(PieGridLineVisualStyle style)
|
||||
{
|
||||
base.CopyTo(style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Design;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a PieReferenceLineVisualStyle.
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class PieReferenceLineVisualStyle : ChartLineVisualStyle
|
||||
{
|
||||
#region ApplyDefaults
|
||||
|
||||
public override void ApplyDefaults()
|
||||
{
|
||||
base.ApplyDefaults();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new PieReferenceLineVisualStyle Copy()
|
||||
{
|
||||
PieReferenceLineVisualStyle style = new PieReferenceLineVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(PieReferenceLineVisualStyle style)
|
||||
{
|
||||
base.CopyTo(style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,765 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Design;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the visual style of a PointMarker
|
||||
/// </summary>
|
||||
[ToolboxItem(false), DesignTimeVisible(false)]
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class PointMarkerVisualStyle : BaseVisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private PointMarkerType _Type = PointMarkerType.NotSet;
|
||||
|
||||
private Background _Background;
|
||||
private Color _BorderColor = Color.Empty;
|
||||
private Size _Size = Size.Empty;
|
||||
|
||||
private int _BorderWidth = -1;
|
||||
private int _PointCount;
|
||||
private int _Rotation = -1;
|
||||
|
||||
private Image _Image;
|
||||
private int _ImageIndex = -1;
|
||||
private ImageList _ImageList;
|
||||
|
||||
private Image _MarkerImage;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region Background
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Marker background for series points.
|
||||
/// </summary>
|
||||
[Description("Indicates the Marker background for series points")]
|
||||
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 Marker border color for series points.
|
||||
/// </summary>
|
||||
[Description("Indicates the point Marker Border Color for series points")]
|
||||
public Color BorderColor
|
||||
{
|
||||
get { return (_BorderColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_BorderColor != value)
|
||||
{
|
||||
_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 BorderWidth
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Marker border width for series points.
|
||||
/// </summary>
|
||||
[DefaultValue(-1)]
|
||||
[Description("Indicates the point Marker Border width for series points")]
|
||||
public int BorderWidth
|
||||
{
|
||||
get { return (_BorderWidth); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_BorderWidth != value)
|
||||
{
|
||||
_BorderWidth = value;
|
||||
|
||||
OnPropertyChangedEx("BorderWidth", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Image
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the PointMarker Image
|
||||
/// </summary>
|
||||
[DefaultValue(null), Category("Appearance")]
|
||||
[Description("Indicates the PointMarker image")]
|
||||
public Image Image
|
||||
{
|
||||
get { return (_Image); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Image != value)
|
||||
{
|
||||
_Image = value;
|
||||
|
||||
FreeMarkerImage();
|
||||
|
||||
OnPropertyChangedEx("Image", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ImageIndex
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the PointMarker image index
|
||||
/// </summary>
|
||||
[DefaultValue(-1)]
|
||||
[Category("Appearance"), Description("Indicates the image index")]
|
||||
[Editor("DevComponents.SuperGrid.Design.ImageIndexEditor, DevComponents.SuperGrid.Design, Version=14.1.0.37, Culture=neutral, PublicKeyToken=90f470f34c89ccaf", typeof(UITypeEditor))]
|
||||
[TypeConverter(typeof(ImageIndexConverter))]
|
||||
public int ImageIndex
|
||||
{
|
||||
get { return (_ImageIndex); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ImageIndex != value)
|
||||
{
|
||||
_ImageIndex = value;
|
||||
|
||||
FreeMarkerImage();
|
||||
|
||||
OnPropertyChangedEx("ImageIndex", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ImageList
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ImageList.
|
||||
/// </summary>
|
||||
[Browsable(true), Category("Appearance"), DefaultValue(null)]
|
||||
[Description("Indicates the ImageList.")]
|
||||
public ImageList ImageList
|
||||
{
|
||||
get { return (_ImageList); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_ImageList != value)
|
||||
{
|
||||
_ImageList = value;
|
||||
|
||||
FreeMarkerImage();
|
||||
|
||||
OnPropertyChangedEx("ImageList", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PointCount
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the number of points for series markers (3 = triangle, 4 square, etc).
|
||||
/// </summary>
|
||||
[DefaultValue(0)]
|
||||
[Description("Indicates the number of points for series markers (3 = triangle, 4 square, etc).")]
|
||||
public int PointCount
|
||||
{
|
||||
get { return (_PointCount); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_PointCount != value)
|
||||
{
|
||||
if (value < 0)
|
||||
throw new Exception("PointMarkerPoints must be >= 0");
|
||||
|
||||
_PointCount = value;
|
||||
|
||||
OnPropertyChangedEx("PointCount", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Rotation
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Marker rotation angle for series points.
|
||||
/// </summary>
|
||||
[Description("Indicates the Marker rotation angle for series points.")]
|
||||
[DefaultValue(-1)]
|
||||
public int Rotation
|
||||
{
|
||||
get { return (_Rotation); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Rotation != value)
|
||||
{
|
||||
_Rotation = value;
|
||||
|
||||
OnPropertyChangedEx("Rotation", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Size
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Marker size for series points
|
||||
/// </summary>
|
||||
[Description("Indicates the Marker size for series points.")]
|
||||
public Size Size
|
||||
{
|
||||
get { return (_Size); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Size != value)
|
||||
{
|
||||
_Size = value;
|
||||
|
||||
OnPropertyChangedEx("Size", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeSize()
|
||||
{
|
||||
return (Size.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetSize()
|
||||
{
|
||||
Size = Size.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Type
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Marker type.
|
||||
/// </summary>
|
||||
[Description("Indicates the Marker type.")]
|
||||
[DefaultValue(PointMarkerType.NotSet)]
|
||||
public PointMarkerType Type
|
||||
{
|
||||
get { return (_Type); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Type != value)
|
||||
{
|
||||
_Type = value;
|
||||
|
||||
OnPropertyChangedEx("Type", 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 == null || _BorderColor.IsEmpty == true) &&
|
||||
(_BorderWidth == -1) &&
|
||||
(_Image == null) &&
|
||||
(_ImageIndex == -1) &&
|
||||
(_ImageList == null) &&
|
||||
(_PointCount <= 0) &&
|
||||
(_Rotation == -1) &&
|
||||
(_Size.IsEmpty == true) &&
|
||||
(_Type == PointMarkerType.NotSet) &&
|
||||
(base.IsEmpty == true));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetPointMarkerImage
|
||||
|
||||
internal Image GetPointMarkerImage()
|
||||
{
|
||||
if (_MarkerImage != null)
|
||||
return (_MarkerImage);
|
||||
|
||||
_MarkerImage = GetPointMarkerImageEx();
|
||||
|
||||
if (_MarkerImage != null)
|
||||
{
|
||||
if (Dpi.UseFactor == true)
|
||||
{
|
||||
Size size = _MarkerImage.Size;
|
||||
|
||||
size.Width *= Dpi.Width1;
|
||||
size.Height *= Dpi.Width1;
|
||||
|
||||
_MarkerImage = new Bitmap(_MarkerImage, size);
|
||||
}
|
||||
}
|
||||
|
||||
return (_MarkerImage);
|
||||
}
|
||||
|
||||
#region GetPointMarkerImageEx
|
||||
|
||||
private Image GetPointMarkerImageEx()
|
||||
{
|
||||
if (_Image != null)
|
||||
return (_Image);
|
||||
|
||||
if (_ImageIndex >= 0)
|
||||
{
|
||||
ImageList imageList = ImageList;
|
||||
|
||||
if (imageList != null && _ImageIndex < imageList.Images.Count)
|
||||
return (imageList.Images[_ImageIndex]);
|
||||
}
|
||||
|
||||
return (null);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region FreeMarkerImage
|
||||
|
||||
private void FreeMarkerImage()
|
||||
{
|
||||
if (_MarkerImage != null)
|
||||
{
|
||||
_MarkerImage.Dispose();
|
||||
|
||||
_MarkerImage = null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region RenderMarker
|
||||
|
||||
internal void RenderMarker(
|
||||
Graphics g, PointMarker pointMarker, Rectangle bounds, Color color)
|
||||
{
|
||||
Image marker = GetPointMarkerImage();
|
||||
|
||||
if (marker != null)
|
||||
{
|
||||
g.DrawImage(marker, bounds);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Type != PointMarkerType.NotSet && Type != PointMarkerType.None)
|
||||
{
|
||||
if (Background.IsEmpty == true)
|
||||
{
|
||||
using (Background back = new Background(color))
|
||||
{
|
||||
marker = pointMarker.GetMarkerBitmap(g, Type, PointCount,
|
||||
bounds.Size, Rotation, back, BorderColor, BorderWidth);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
marker = pointMarker.GetMarkerBitmap(g, Type, PointCount,
|
||||
bounds.Size, Rotation, Background, BorderColor, BorderWidth);
|
||||
}
|
||||
}
|
||||
|
||||
if (marker != null)
|
||||
{
|
||||
// Make allowances for the fact that GetPointMarker() adjusts the
|
||||
// size and pos of the image to allow for better anti-aliasing
|
||||
|
||||
bounds.X--;
|
||||
bounds.Y--;
|
||||
|
||||
g.DrawImageUnscaled(marker, bounds);
|
||||
}
|
||||
else
|
||||
{
|
||||
RenderDefaultMarker(g, bounds, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region RenderDefaultMarker
|
||||
|
||||
private void RenderDefaultMarker(Graphics g, Rectangle bounds, Color color)
|
||||
{
|
||||
bounds.Width++;
|
||||
bounds.Height++;
|
||||
|
||||
Background background = Background;
|
||||
|
||||
if (background.IsEmpty == true)
|
||||
{
|
||||
if (color.IsEmpty == true)
|
||||
color = Color.DimGray;
|
||||
|
||||
using (Brush br = new SolidBrush(color))
|
||||
g.FillRectangle(br, bounds);
|
||||
}
|
||||
else
|
||||
{
|
||||
using (Brush br = background.GetBrush(bounds))
|
||||
g.FillRectangle(br, bounds);
|
||||
}
|
||||
|
||||
if (BorderColor.IsEmpty == false && BorderWidth > 0)
|
||||
{
|
||||
using (Pen pen = new Pen(BorderColor, BorderWidth))
|
||||
{
|
||||
pen.Alignment = System.Drawing.Drawing2D.PenAlignment.Inset;
|
||||
|
||||
g.DrawRectangle(pen, bounds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(PointMarkerVisualStyle 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.BorderWidth >= 0)
|
||||
BorderWidth = style.BorderWidth;
|
||||
|
||||
if (style.Image != null)
|
||||
Image = style.Image;
|
||||
|
||||
if (style.ImageIndex >= 0)
|
||||
ImageIndex = style.ImageIndex;
|
||||
|
||||
if (style._ImageList != null)
|
||||
ImageList = style._ImageList;
|
||||
|
||||
if (style.PointCount > 0)
|
||||
PointCount = style.PointCount;
|
||||
|
||||
if (style.Rotation != -1)
|
||||
Rotation = style.Rotation;
|
||||
|
||||
if (style.Size.IsEmpty == false)
|
||||
Size = style.Size;
|
||||
|
||||
if (style.Type != PointMarkerType.NotSet)
|
||||
Type = style.Type;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyDefaults
|
||||
|
||||
public override void ApplyDefaults()
|
||||
{
|
||||
if (PointCount <= 0)
|
||||
PointCount = 5;
|
||||
|
||||
if (Size.IsEmpty)
|
||||
Size = new Size(5, 5);
|
||||
|
||||
if (BorderWidth == -1)
|
||||
BorderWidth = 1;
|
||||
|
||||
base.ApplyDefaults();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new PointMarkerVisualStyle Copy()
|
||||
{
|
||||
PointMarkerVisualStyle style = new PointMarkerVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(PointMarkerVisualStyle style)
|
||||
{
|
||||
base.CopyTo(style);
|
||||
|
||||
style.Background = (_Background != null) ? _Background.Copy() : null;
|
||||
|
||||
style.BorderColor = _BorderColor;
|
||||
style.BorderWidth = _BorderWidth;
|
||||
|
||||
style.Image = _Image;
|
||||
style.ImageIndex = _ImageIndex;
|
||||
style.ImageList = _ImageList;
|
||||
|
||||
style.PointCount = _PointCount;
|
||||
style.Rotation = _Rotation;
|
||||
style.Size = _Size;
|
||||
style.Type = _Type;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSerialData
|
||||
|
||||
internal override SerialElementCollection GetSerialData(string serialName)
|
||||
{
|
||||
SerialElementCollection sec = new SerialElementCollection();
|
||||
|
||||
if (serialName != null)
|
||||
{
|
||||
if (serialName.Equals("") == true)
|
||||
serialName = "PointMarkerVisualStyle";
|
||||
|
||||
sec.AddStartElement(serialName);
|
||||
}
|
||||
|
||||
if (_Background != null && _Background.IsEmpty == false)
|
||||
sec.AddElement(_Background.GetSerialData("Background"));
|
||||
|
||||
sec.AddValue("BorderColor", _BorderColor, Color.Empty);
|
||||
sec.AddValue("BorderWidth", _BorderWidth, -1);
|
||||
|
||||
sec.AddValue("Image", Image);
|
||||
sec.AddValue("ImageIndex", _ImageIndex, -1);
|
||||
|
||||
if (_ImageList != null)
|
||||
sec.AddValue("ImageList", XmlSerializableImageList.ConvertToString(ImageList));
|
||||
|
||||
sec.AddValue("PointCount", _PointCount, 0);
|
||||
sec.AddValue("Rotation", _Rotation, -1);
|
||||
sec.AddValue("Size", _Size, Size.Empty);
|
||||
sec.AddValue("Type", _Type, PointMarkerType.NotSet);
|
||||
|
||||
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 "BorderWidth":
|
||||
BorderWidth = int.Parse(se.StringValue);
|
||||
break;
|
||||
|
||||
case "Image":
|
||||
Image = se.GetValueImage();
|
||||
break;
|
||||
|
||||
case "ImageIndex":
|
||||
ImageIndex = int.Parse(se.StringValue);
|
||||
break;
|
||||
|
||||
case "ImageList":
|
||||
ImageList = XmlSerializableImageList.ConvertFromString(se.StringValue);
|
||||
break;
|
||||
|
||||
case "PointCount":
|
||||
PointCount = int.Parse(se.StringValue);
|
||||
break;
|
||||
|
||||
case "Rotation":
|
||||
Rotation = int.Parse(se.StringValue);
|
||||
break;
|
||||
|
||||
case "Size":
|
||||
Size = se.GetValueSize();
|
||||
break;
|
||||
|
||||
case "Type":
|
||||
Type = (PointMarkerType)se.GetValueEnum(typeof(PointMarkerType));
|
||||
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;
|
||||
|
||||
default:
|
||||
base.ProcessCollection(se);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
Background = null;
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,460 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Design;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a ReferenceLineVisualStyle.
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class ReferenceLineVisualStyle : ChartLineVisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private Alignment _TextAlignment = Alignment.NotSet;
|
||||
private Tbool _AllowWrap = Tbool.NotSet;
|
||||
private Color _TextColor = Color.Empty;
|
||||
private Padding _TextPadding;
|
||||
private Font _Font;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#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.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#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 TextAlignment
|
||||
|
||||
///<summary>
|
||||
/// Gets or sets the Text alignment.
|
||||
///</summary>
|
||||
[DefaultValue(Alignment.NotSet), Category("Appearance")]
|
||||
[Description("Indicates the Text alignment.")]
|
||||
public Alignment TextAlignment
|
||||
{
|
||||
get { return (_TextAlignment); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _TextAlignment)
|
||||
{
|
||||
_TextAlignment = value;
|
||||
|
||||
OnPropertyChangedEx("TextAlignment", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TextColor
|
||||
|
||||
///<summary>
|
||||
/// Gets or sets the Reference Line Text Color.
|
||||
///</summary>
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates the Reference Line Text Color.")]
|
||||
public Color TextColor
|
||||
{
|
||||
get { return (_TextColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _TextColor)
|
||||
{
|
||||
_TextColor = value;
|
||||
|
||||
OnPropertyChangedEx("TextColor", Style.VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public bool ShouldSerializeTextColor()
|
||||
{
|
||||
return (_TextColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public void ResetTextColor()
|
||||
{
|
||||
_TextColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TextPadding
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets spacing between the content and edges of the Text.
|
||||
/// </summary>
|
||||
[Description("Indicates the spacing between the content and edges of the Text")]
|
||||
public Padding TextPadding
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_TextPadding == null)
|
||||
{
|
||||
_TextPadding = Padding.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _TextPadding);
|
||||
}
|
||||
|
||||
return (_TextPadding);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_TextPadding != value)
|
||||
{
|
||||
UpdateChangeHandler(_TextPadding, value);
|
||||
|
||||
_TextPadding = value;
|
||||
|
||||
OnPropertyChangedEx("TextPadding", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeTextPadding()
|
||||
{
|
||||
return (_TextPadding != null && _TextPadding.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetTextPadding()
|
||||
{
|
||||
TextPadding = null;
|
||||
}
|
||||
|
||||
#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 ((_AllowWrap == Tbool.NotSet) &&
|
||||
(_Font == null) &&
|
||||
(_TextAlignment == Alignment.NotSet) &&
|
||||
(_TextColor.IsEmpty == true) &&
|
||||
(_TextPadding == null || _TextPadding.IsEmpty == true) &&
|
||||
(base.IsEmpty == true));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetStringFormatFlags
|
||||
|
||||
internal void GetStringFormatFlags(StringFormat sf)
|
||||
{
|
||||
if (AllowWrap == Tbool.False)
|
||||
{
|
||||
sf.FormatFlags |= StringFormatFlags.NoWrap;
|
||||
sf.Trimming = StringTrimming.None;
|
||||
}
|
||||
|
||||
switch (TextAlignment)
|
||||
{
|
||||
case Alignment.TopLeft:
|
||||
sf.Alignment = StringAlignment.Near;
|
||||
break;
|
||||
|
||||
case Alignment.TopCenter:
|
||||
sf.Alignment = StringAlignment.Center;
|
||||
break;
|
||||
|
||||
case Alignment.TopRight:
|
||||
sf.Alignment = StringAlignment.Far;
|
||||
break;
|
||||
|
||||
case Alignment.MiddleLeft:
|
||||
sf.Alignment = StringAlignment.Near;
|
||||
break;
|
||||
|
||||
case Alignment.MiddleCenter:
|
||||
sf.Alignment = StringAlignment.Center;
|
||||
break;
|
||||
|
||||
case Alignment.MiddleRight:
|
||||
sf.Alignment = StringAlignment.Far;
|
||||
break;
|
||||
|
||||
case Alignment.BottomLeft:
|
||||
sf.Alignment = StringAlignment.Near;
|
||||
break;
|
||||
|
||||
case Alignment.BottomCenter:
|
||||
sf.Alignment = StringAlignment.Center;
|
||||
break;
|
||||
|
||||
case Alignment.BottomRight:
|
||||
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(ReferenceLineVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style.AllowWrap != Tbool.NotSet)
|
||||
_AllowWrap = style.AllowWrap;
|
||||
|
||||
if (style.Font != null)
|
||||
_Font = (Font)style.Font.Clone();
|
||||
|
||||
if (style.TextAlignment != Alignment.NotSet)
|
||||
_TextAlignment = style.TextAlignment;
|
||||
|
||||
if (style.TextColor.IsEmpty == false)
|
||||
_TextColor = style.TextColor;
|
||||
|
||||
if (style._TextPadding != null && style._TextPadding.IsEmpty == false)
|
||||
TextPadding = style.TextPadding.Copy();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new ReferenceLineVisualStyle Copy()
|
||||
{
|
||||
ReferenceLineVisualStyle style = new ReferenceLineVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(ReferenceLineVisualStyle style)
|
||||
{
|
||||
base.CopyTo(style);
|
||||
|
||||
style.AllowWrap = _AllowWrap;
|
||||
|
||||
style.Font = (_Font != null) ? (Font)_Font.Clone() : null;
|
||||
|
||||
style.TextAlignment = _TextAlignment;
|
||||
style.TextColor = _TextColor;
|
||||
|
||||
style.TextPadding = (_TextPadding != null) ? _TextPadding.Copy() : null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSerialData
|
||||
|
||||
internal override SerialElementCollection GetSerialData(string serialName)
|
||||
{
|
||||
SerialElementCollection sec = new SerialElementCollection();
|
||||
|
||||
if (serialName != null)
|
||||
{
|
||||
if (serialName.Equals("") == true)
|
||||
serialName = "ReferenceLineVisualStyle";
|
||||
|
||||
sec.AddStartElement(serialName);
|
||||
}
|
||||
|
||||
sec.AddValue("AllowWrap", AllowWrap, Tbool.NotSet);
|
||||
|
||||
if (_Font != null)
|
||||
sec.AddValue("Font", XmlSerializableFont.ConvertToString(Font));
|
||||
|
||||
sec.AddValue("TextAlignment", TextAlignment, Alignment.NotSet);
|
||||
sec.AddValue("TextColor", TextColor, Color.Empty);
|
||||
|
||||
if (_TextPadding != null && _TextPadding.IsEmpty == false)
|
||||
sec.AddElement(_TextPadding.GetSerialData("TextPadding"));
|
||||
|
||||
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 "AllowWrap":
|
||||
AllowWrap = (Tbool)se.GetValueEnum(typeof(Tbool));
|
||||
break;
|
||||
|
||||
case "Font":
|
||||
Font = XmlSerializableFont.ConvertFromString(se.StringValue);
|
||||
break;
|
||||
|
||||
case "TextAlignment":
|
||||
TextAlignment = (Alignment)se.GetValueEnum(typeof(Alignment));
|
||||
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 "TextPadding":
|
||||
sec.PutSerialData(TextPadding);
|
||||
break;
|
||||
|
||||
default:
|
||||
base.ProcessCollection(se);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
TextPadding = null;
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region enums
|
||||
|
||||
#region NearAlignment
|
||||
|
||||
public enum NearAlignment
|
||||
{
|
||||
NotSet = -1,
|
||||
|
||||
Near,
|
||||
|
||||
Far,
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the visual style of a Legend element.
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class RegressionLineVisualStyle : ChartCapLineVisualStyle
|
||||
{
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new RegressionLineVisualStyle Copy()
|
||||
{
|
||||
RegressionLineVisualStyle style = new RegressionLineVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(RegressionLineVisualStyle style)
|
||||
{
|
||||
base.CopyTo(style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,739 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
///<summary>
|
||||
/// ScrollBarVisualStyle
|
||||
///</summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class ScrollBarVisualStyles : VisualStyles<ScrollBarVisualStyle>
|
||||
{
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public ScrollBarVisualStyles Copy()
|
||||
{
|
||||
ScrollBarVisualStyles styles = new ScrollBarVisualStyles();
|
||||
|
||||
for (int i = 0; i < Styles.Length; i++)
|
||||
{
|
||||
ScrollBarVisualStyle vstyle = Styles[i];
|
||||
|
||||
if (vstyle != null)
|
||||
styles.Styles[i] = vstyle.Copy();
|
||||
}
|
||||
|
||||
return (styles);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the visual style of a ScrollBar element.
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class ScrollBarVisualStyle : BaseVisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private Color _ArrowColor;
|
||||
private Color _ArrowBorderColor;
|
||||
private Background _ArrowBackground;
|
||||
|
||||
private Color _ThumbColor;
|
||||
private Color _ThumbBorderColor;
|
||||
private Background _ThumbBackground;
|
||||
|
||||
private Color _BorderColor;
|
||||
private Background _TrackBackground;
|
||||
|
||||
private Tbool _NoAlphaOnMouseOver = Tbool.NotSet;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region ArrowBackground
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Background of the Increase/Decrease Arrow elements of the ScrollBar.
|
||||
/// </summary>
|
||||
[Description("Indicates the Background of the Increase/Decrease Arrow elements of the ScrollBar")]
|
||||
public Background ArrowBackground
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_ArrowBackground == null)
|
||||
{
|
||||
_ArrowBackground = Background.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _ArrowBackground);
|
||||
}
|
||||
|
||||
return (_ArrowBackground);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _ArrowBackground)
|
||||
{
|
||||
UpdateChangeHandler(_ArrowBackground, value);
|
||||
|
||||
_ArrowBackground = value;
|
||||
|
||||
OnPropertyChangedEx("ArrowBackground", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeArrowBackground()
|
||||
{
|
||||
return (_ArrowBackground != null && _ArrowBackground.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetArrowBackground()
|
||||
{
|
||||
ArrowBackground = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ArrowBorderColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Arrow Increase/Decrease border color.
|
||||
/// </summary>
|
||||
[Description("Indicates the Arrow Increase/Decrease border color")]
|
||||
public Color ArrowBorderColor
|
||||
{
|
||||
get { return (_ArrowBorderColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _ArrowBorderColor)
|
||||
{
|
||||
_ArrowBorderColor = value;
|
||||
|
||||
OnPropertyChangedEx("ArrowBorderColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeArrowBorderColor()
|
||||
{
|
||||
return (_ArrowBorderColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetArrowBorderColor()
|
||||
{
|
||||
ArrowBorderColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ArrowColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Color of the Increase/Decrease Arrow elements of the scrollBar.
|
||||
/// </summary>
|
||||
[Description("Indicates the Color of the Increase/Decrease Arrow elements of the scrollBar")]
|
||||
public Color ArrowColor
|
||||
{
|
||||
get { return (_ArrowColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _ArrowColor)
|
||||
{
|
||||
_ArrowColor = value;
|
||||
|
||||
OnPropertyChangedEx("ArrowColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeArrowColor()
|
||||
{
|
||||
return (_ArrowColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetArrowColor()
|
||||
{
|
||||
ArrowColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BorderColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the border color of the scrollBar.
|
||||
/// </summary>
|
||||
[Description("Indicates the Border Color of the scrollBar")]
|
||||
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 NoAlphaOnMouseOver
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether color alpha values are ignored when the mouse is over the scrollbar.
|
||||
/// </summary>
|
||||
[DefaultValue(Tbool.NotSet)]
|
||||
[Description("Indicates whether color alpha values are ignored when the mouse is over the scrollbar.")]
|
||||
public Tbool NoAlphaOnMouseOver
|
||||
{
|
||||
get { return (_NoAlphaOnMouseOver); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _NoAlphaOnMouseOver)
|
||||
{
|
||||
_NoAlphaOnMouseOver = value;
|
||||
|
||||
OnPropertyChangedEx("NoAlphaOnMouseOver", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ThumbBackground
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Background of the Thumb element of the ScrollBar.
|
||||
/// </summary>
|
||||
[Description("Indicates the Background of the Thumb element of the ScrollBar")]
|
||||
public Background ThumbBackground
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_ThumbBackground == null)
|
||||
{
|
||||
_ThumbBackground = Background.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _ThumbBackground);
|
||||
}
|
||||
|
||||
return (_ThumbBackground);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _ThumbBackground)
|
||||
{
|
||||
UpdateChangeHandler(_ThumbBackground, value);
|
||||
|
||||
_ThumbBackground = value;
|
||||
|
||||
OnPropertyChangedEx("ThumbBackground", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeThumbBackground()
|
||||
{
|
||||
return (_ThumbBackground != null && _ThumbBackground.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetThumbBackground()
|
||||
{
|
||||
ThumbBackground = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ThumbBorderColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Thumb border color.
|
||||
/// </summary>
|
||||
[Description("Indicates the Thumb border color")]
|
||||
public Color ThumbBorderColor
|
||||
{
|
||||
get { return (_ThumbBorderColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _ThumbBorderColor)
|
||||
{
|
||||
_ThumbBorderColor = value;
|
||||
|
||||
OnPropertyChangedEx("ThumbBorderColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeThumbBorderColor()
|
||||
{
|
||||
return (_ThumbBorderColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetThumbBorderColor()
|
||||
{
|
||||
ThumbBorderColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ThumbColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Color of the Thumb content element (hash marks) of the scrollBar.
|
||||
/// </summary>
|
||||
[Description("Indicates the Color of the Thumb content element (hash marks) of the scrollBar")]
|
||||
public Color ThumbColor
|
||||
{
|
||||
get { return (_ThumbColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _ThumbColor)
|
||||
{
|
||||
_ThumbColor = value;
|
||||
|
||||
OnPropertyChangedEx("ThumbColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeThumbColor()
|
||||
{
|
||||
return (_ThumbColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetThumbColor()
|
||||
{
|
||||
ThumbColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TrackBackground
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Background of the Increase/Decrease Track elements of the ScrollBar.
|
||||
/// </summary>
|
||||
[Description("Indicates the Background of the Increase/Decrease Track elements of the ScrollBar")]
|
||||
public Background TrackBackground
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_TrackBackground == null)
|
||||
{
|
||||
_TrackBackground = Background.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _TrackBackground);
|
||||
}
|
||||
|
||||
return (_TrackBackground);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_TrackBackground != value)
|
||||
{
|
||||
UpdateChangeHandler(_TrackBackground, value);
|
||||
|
||||
_TrackBackground = value;
|
||||
|
||||
OnPropertyChangedEx("TrackBackground", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeTrackBackground()
|
||||
{
|
||||
return (_TrackBackground != null && _TrackBackground.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetTrackBackground()
|
||||
{
|
||||
TrackBackground = null;
|
||||
}
|
||||
|
||||
#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 ((_ArrowBackground == null || _ArrowBackground.IsEmpty) &&
|
||||
(_ArrowBorderColor.IsEmpty) &&
|
||||
(_ArrowColor.IsEmpty) &&
|
||||
(_BorderColor.IsEmpty) &&
|
||||
(_NoAlphaOnMouseOver == Tbool.NotSet) &&
|
||||
(_ThumbBackground == null || _ThumbBackground.IsEmpty) &&
|
||||
(_ThumbBorderColor.IsEmpty) &&
|
||||
(_ThumbColor.IsEmpty) &&
|
||||
(_TrackBackground == null || _TrackBackground.IsEmpty) &&
|
||||
(base.IsEmpty == true));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetColor
|
||||
|
||||
internal Color GetColor(Color color, bool noAlpha)
|
||||
{
|
||||
if (noAlpha == false)
|
||||
return (color);
|
||||
|
||||
uint argb = (uint)color.ToArgb() | 0xff000000;
|
||||
|
||||
return (Color.FromArgb((int)argb));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(ScrollBarVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style.ArrowBackground.IsEmpty == false)
|
||||
ArrowBackground = style.ArrowBackground.Copy();
|
||||
|
||||
if (style.ArrowBorderColor.IsEmpty == false)
|
||||
ArrowBorderColor = style.ArrowBorderColor;
|
||||
|
||||
if (style.ArrowColor.IsEmpty == false)
|
||||
ArrowColor = style.ArrowColor;
|
||||
|
||||
if (style.BorderColor.IsEmpty == false)
|
||||
BorderColor = style.BorderColor;
|
||||
|
||||
if (style.NoAlphaOnMouseOver != Tbool.NotSet)
|
||||
NoAlphaOnMouseOver = style.NoAlphaOnMouseOver;
|
||||
|
||||
if (style.ThumbBackground.IsEmpty == false)
|
||||
ThumbBackground = style.ThumbBackground.Copy();
|
||||
|
||||
if (style.ThumbBorderColor.IsEmpty == false)
|
||||
ThumbBorderColor = style.ThumbBorderColor;
|
||||
|
||||
if (style.ThumbColor.IsEmpty == false)
|
||||
ThumbColor = style.ThumbColor;
|
||||
|
||||
if (style.TrackBackground.IsEmpty == false)
|
||||
TrackBackground = style.TrackBackground.Copy();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyDefaults
|
||||
|
||||
public override void ApplyDefaults()
|
||||
{
|
||||
if (ArrowBackground.IsEmpty)
|
||||
ArrowBackground = new Background(Color.Gainsboro);
|
||||
|
||||
if (ThumbBackground.IsEmpty)
|
||||
ThumbBackground = new Background(Color.White, Color.Gainsboro);
|
||||
|
||||
if (TrackBackground.IsEmpty)
|
||||
TrackBackground = new Background(Color.Gainsboro);
|
||||
|
||||
if (BorderColor.IsEmpty)
|
||||
BorderColor = Color.Gray;
|
||||
|
||||
if (ThumbBorderColor.IsEmpty)
|
||||
ThumbBorderColor = Color.Gray;
|
||||
|
||||
if (ArrowColor.IsEmpty)
|
||||
ArrowColor = Color.DimGray;
|
||||
|
||||
if (ThumbColor.IsEmpty)
|
||||
ThumbColor = Color.Black;
|
||||
|
||||
if (ArrowBorderColor.IsEmpty)
|
||||
ArrowBorderColor = Color.Gray;
|
||||
|
||||
if (NoAlphaOnMouseOver == Tbool.NotSet)
|
||||
NoAlphaOnMouseOver = Tbool.False;
|
||||
|
||||
base.ApplyDefaults();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new ScrollBarVisualStyle Copy()
|
||||
{
|
||||
ScrollBarVisualStyle style = new ScrollBarVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(ScrollBarVisualStyle style)
|
||||
{
|
||||
base.CopyTo(style);
|
||||
|
||||
style.ArrowBackground = (_ArrowBackground != null ? _ArrowBackground.Copy() : null);
|
||||
|
||||
style.ArrowBorderColor = _ArrowBorderColor;
|
||||
style.ArrowColor = _ArrowColor;
|
||||
style.BorderColor = _BorderColor;
|
||||
style.NoAlphaOnMouseOver = _NoAlphaOnMouseOver;
|
||||
|
||||
style.ThumbBackground = (_ThumbBackground != null ? _ThumbBackground.Copy() : null);
|
||||
|
||||
style.ThumbBorderColor = _ThumbBorderColor;
|
||||
style.ThumbColor = _ThumbColor;
|
||||
|
||||
style.TrackBackground = (_TrackBackground != null ? _TrackBackground.Copy() : null);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSerialData
|
||||
|
||||
internal override SerialElementCollection GetSerialData(string serialName)
|
||||
{
|
||||
SerialElementCollection sec = new SerialElementCollection();
|
||||
|
||||
if (serialName != null)
|
||||
{
|
||||
if (serialName.Equals("") == true)
|
||||
serialName = "ScrollBarVisualStyle";
|
||||
|
||||
sec.AddStartElement(serialName);
|
||||
}
|
||||
|
||||
if (_ArrowBackground != null && _ArrowBackground.IsEmpty == false)
|
||||
sec.AddElement(_ArrowBackground.GetSerialData("ArrowBackground"));
|
||||
|
||||
sec.AddValue("ArrowBorderColor", ArrowBorderColor, Color.Empty);
|
||||
sec.AddValue("ArrowColor", ArrowColor, Color.Empty);
|
||||
sec.AddValue("BorderColor", BorderColor, Color.Empty);
|
||||
sec.AddValue("NoAlphaOnMouseOver", NoAlphaOnMouseOver, Tbool.NotSet);
|
||||
|
||||
if (_ThumbBackground != null && _ThumbBackground.IsEmpty == false)
|
||||
sec.AddElement(_ThumbBackground.GetSerialData("ThumbBackground"));
|
||||
|
||||
sec.AddValue("ThumbBorderColor", ThumbBorderColor, Color.Empty);
|
||||
sec.AddValue("ThumbColor", ThumbColor, Color.Empty);
|
||||
|
||||
if (_TrackBackground != null && _TrackBackground.IsEmpty == false)
|
||||
sec.AddElement(_TrackBackground.GetSerialData("TrackBackground"));
|
||||
|
||||
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 "ArrowBorderColor":
|
||||
ArrowBorderColor = se.GetValueColor();
|
||||
break;
|
||||
|
||||
case "ArrowColor":
|
||||
ArrowColor = se.GetValueColor();
|
||||
break;
|
||||
|
||||
case "BorderColor":
|
||||
BorderColor = se.GetValueColor();
|
||||
break;
|
||||
|
||||
case "NoAlphaOnMouseOver":
|
||||
NoAlphaOnMouseOver = (Tbool)se.GetValueEnum(typeof(Tbool));
|
||||
break;
|
||||
|
||||
case "ThumbBorderColor":
|
||||
ThumbBorderColor = se.GetValueColor();
|
||||
break;
|
||||
|
||||
case "ThumbColor":
|
||||
ThumbColor = 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 "ArrowBackground":
|
||||
sec.PutSerialData(ArrowBackground);
|
||||
break;
|
||||
|
||||
case "ThumbBackground":
|
||||
sec.PutSerialData(ThumbBackground);
|
||||
break;
|
||||
|
||||
case "TrackBackground":
|
||||
sec.PutSerialData(TrackBackground);
|
||||
break;
|
||||
|
||||
default:
|
||||
base.ProcessCollection(se);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
ArrowBackground = null;
|
||||
ThumbBackground = null;
|
||||
TrackBackground = null;
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,602 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Design;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a SeriesLabelVisualStyle.
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class SeriesLabelVisualStyle : ContainerVisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private Color _ConnectorColor = Color.Empty;
|
||||
private LinePattern _ConnectorPattern = LinePattern.NotSet;
|
||||
|
||||
private int _ConnectorLength = -1;
|
||||
private int _ConnectorThickness = -1;
|
||||
|
||||
private Tbool _DrawConnector = Tbool.NotSet;
|
||||
private Tbool _ShowBaseValueLabels = Tbool.NotSet;
|
||||
|
||||
private Size _MaximumSize = Size.Empty;
|
||||
private Size _MinimumSize = Size.Empty;
|
||||
|
||||
private Point _Offset;
|
||||
|
||||
private float _Rotation = float.NaN;
|
||||
|
||||
private string _TextFormat;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region ConnectorColor
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the style border color.
|
||||
/// </summary>
|
||||
[Description("Indicates the style Border Color")]
|
||||
public Color ConnectorColor
|
||||
{
|
||||
get { return (_ConnectorColor); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _ConnectorColor)
|
||||
{
|
||||
_ConnectorColor = value;
|
||||
|
||||
OnPropertyChangedEx("ConnectorColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeConnectorColor()
|
||||
{
|
||||
return (_ConnectorColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetConnectorColor()
|
||||
{
|
||||
_ConnectorColor = Color.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ConnectorLength
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the length of the line connecting the slice
|
||||
/// and the slice label.
|
||||
/// </summary>
|
||||
[DefaultValue(-1), Category("Appearance")]
|
||||
[Description("Indicates the length of the line connecting the slice and the slice label.")]
|
||||
public int ConnectorLength
|
||||
{
|
||||
get { return (_ConnectorLength); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _ConnectorLength)
|
||||
{
|
||||
if (value < 0)
|
||||
throw new InvalidPropertyValueException("value cannot be negative.");
|
||||
|
||||
_ConnectorLength = value;
|
||||
|
||||
OnPropertyChangedEx("ConnectorLength", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ConnectorPattern
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the style border pattern (Solid, Dash, ...)
|
||||
/// </summary>
|
||||
[Description("Indicates the style border pattern (Solid, Dash, ...)")]
|
||||
[DefaultValue(LinePattern.NotSet)]
|
||||
public LinePattern ConnectorPattern
|
||||
{
|
||||
get { return (_ConnectorPattern); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _ConnectorPattern)
|
||||
{
|
||||
_ConnectorPattern = value;
|
||||
|
||||
OnPropertyChangedEx("ConnectorPattern", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ConnectorThickness
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the style border thickness.
|
||||
/// </summary>
|
||||
[DefaultValue(-1), Category("Appearance")]
|
||||
[Description("Indicates the style border thickness")]
|
||||
public int ConnectorThickness
|
||||
{
|
||||
get { return (_ConnectorThickness); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _ConnectorThickness)
|
||||
{
|
||||
_ConnectorThickness = value;
|
||||
|
||||
OnPropertyChangedEx("ConnectorThickness", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#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 MaximumSize
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum size of the label.
|
||||
/// </summary>
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates the maximum size of the label.")]
|
||||
public Size MaximumSize
|
||||
{
|
||||
get { return (_MaximumSize); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _MaximumSize)
|
||||
{
|
||||
_MaximumSize = value;
|
||||
|
||||
OnPropertyChangedEx("MaximumSize", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeCMaximumSize()
|
||||
{
|
||||
return (_MaximumSize.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetMaximumSize()
|
||||
{
|
||||
MaximumSize = Size.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region MinimumSize
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the minimum size of the label.
|
||||
/// </summary>
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates the minimum size of the label.")]
|
||||
public Size MinimumSize
|
||||
{
|
||||
get { return (_MinimumSize); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _MinimumSize)
|
||||
{
|
||||
_MinimumSize = value;
|
||||
|
||||
OnPropertyChangedEx("MinimumSize", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeMinimumSize()
|
||||
{
|
||||
return (_MinimumSize.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetMinimumSize()
|
||||
{
|
||||
MinimumSize = Size.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Offset
|
||||
|
||||
///<summary>
|
||||
/// Gets or sets the offset of the label relative to the data point.
|
||||
///</summary>
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates the offset of the label relative to the data point.")]
|
||||
public Point Offset
|
||||
{
|
||||
get { return (_Offset); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _Offset)
|
||||
{
|
||||
_Offset = value;
|
||||
|
||||
OnPropertyChangedEx("Offset", Style.VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeOffset()
|
||||
{
|
||||
return (_Offset.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetOffset()
|
||||
{
|
||||
Offset = Point.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Rotation
|
||||
|
||||
///<summary>
|
||||
/// Gets or sets the amount to rotate the label body.
|
||||
///</summary>
|
||||
[DefaultValue(float.NaN), Category("Appearance")]
|
||||
[Description("Indicates the amount to rotate the label body.")]
|
||||
public float Rotation
|
||||
{
|
||||
get { return (_Rotation); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _Rotation)
|
||||
{
|
||||
_Rotation = value;
|
||||
|
||||
OnPropertyChangedEx("Rotation", Style.VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ShowBaseValueLabels
|
||||
|
||||
///<summary>
|
||||
/// Gets or sets whether Labels are shown for Base Values.
|
||||
///</summary>
|
||||
[DefaultValue(Tbool.NotSet), Category("DataLabel")]
|
||||
[Description("Indicates whether Labels are shown for Base Values.")]
|
||||
public Tbool ShowBaseValueLabels
|
||||
{
|
||||
get { return (_ShowBaseValueLabels); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _ShowBaseValueLabels)
|
||||
{
|
||||
_ShowBaseValueLabels = value;
|
||||
|
||||
OnPropertyChangedEx("ShowBaseValueLabels", Style.VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TextFormat
|
||||
|
||||
///<summary>
|
||||
/// Gets or sets the format specifier for the label text.
|
||||
///</summary>
|
||||
[Category("Appearance")]
|
||||
[Description("Indicates the format specifier for the label text.")]
|
||||
public string TextFormat
|
||||
{
|
||||
get { return (_TextFormat); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _TextFormat)
|
||||
{
|
||||
_TextFormat = value;
|
||||
|
||||
OnPropertyChangedEx("TextFormat", Style.VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#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 ((_ConnectorColor == Color.Empty) &&
|
||||
(_ConnectorLength == -1) &&
|
||||
(_ConnectorPattern == LinePattern.NotSet) &&
|
||||
(_ConnectorThickness == -1) &&
|
||||
(_DrawConnector == Tbool.NotSet) &&
|
||||
(_MaximumSize == Size.Empty) &&
|
||||
(_MinimumSize == Size.Empty) &&
|
||||
(_Offset == Point.Empty) &&
|
||||
(_Rotation == float.NaN) &&
|
||||
(_ShowBaseValueLabels == Tbool.NotSet) &&
|
||||
(String.IsNullOrEmpty(_TextFormat)) &&
|
||||
(base.IsEmpty == true));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(SeriesLabelVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style.ConnectorColor != Color.Empty)
|
||||
_ConnectorColor = style.ConnectorColor;
|
||||
|
||||
if (style.ConnectorLength != -1)
|
||||
_ConnectorLength = style.ConnectorLength;
|
||||
|
||||
if (style.ConnectorPattern != LinePattern.NotSet)
|
||||
_ConnectorPattern = style.ConnectorPattern;
|
||||
|
||||
if (style.ConnectorThickness != -1)
|
||||
_ConnectorThickness = style.ConnectorThickness;
|
||||
|
||||
if (style.DrawConnector != Tbool.NotSet)
|
||||
_DrawConnector = style.DrawConnector;
|
||||
|
||||
if (style.MaximumSize != Size.Empty)
|
||||
_MaximumSize = style.MaximumSize;
|
||||
|
||||
if (style.MinimumSize != Size.Empty)
|
||||
_MinimumSize = style.MinimumSize;
|
||||
|
||||
if (style.Offset != Point.Empty)
|
||||
_Offset = style.Offset;
|
||||
|
||||
if (style.Rotation == float.NaN)
|
||||
_Rotation = style.Rotation;
|
||||
|
||||
if (style.ShowBaseValueLabels == Tbool.NotSet)
|
||||
_ShowBaseValueLabels = style.ShowBaseValueLabels;
|
||||
|
||||
if (String.IsNullOrEmpty(style.TextFormat) == false)
|
||||
_TextFormat = style.TextFormat;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new SeriesLabelVisualStyle Copy()
|
||||
{
|
||||
SeriesLabelVisualStyle style = new SeriesLabelVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(SeriesLabelVisualStyle style)
|
||||
{
|
||||
base.CopyTo(style);
|
||||
|
||||
style.ConnectorColor = _ConnectorColor;
|
||||
style.ConnectorLength = _ConnectorLength;
|
||||
style.ConnectorPattern = _ConnectorPattern;
|
||||
style.ConnectorThickness = _ConnectorThickness;
|
||||
style.DrawConnector = _DrawConnector;
|
||||
style.MaximumSize = _MaximumSize;
|
||||
style.MinimumSize = _MinimumSize;
|
||||
style.Offset = _Offset;
|
||||
style.Rotation = _Rotation;
|
||||
style.ShowBaseValueLabels = _ShowBaseValueLabels;
|
||||
style.TextFormat = _TextFormat;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSerialData
|
||||
|
||||
internal override SerialElementCollection GetSerialData(string serialName)
|
||||
{
|
||||
SerialElementCollection sec = new SerialElementCollection();
|
||||
|
||||
if (serialName != null)
|
||||
{
|
||||
if (serialName.Equals("") == true)
|
||||
serialName = "SeriesLabelVisualStyle";
|
||||
|
||||
sec.AddStartElement(serialName);
|
||||
}
|
||||
|
||||
sec.AddValue("ConnectorColor", ConnectorColor, Color.Empty);
|
||||
sec.AddValue("ConnectorLength", ConnectorLength, -1);
|
||||
sec.AddValue("ConnectorPattern", ConnectorPattern, LinePattern.NotSet);
|
||||
sec.AddValue("ConnectorThickness", ConnectorThickness, -1);
|
||||
sec.AddValue("DrawConnector", DrawConnector, Tbool.NotSet);
|
||||
|
||||
sec.AddValue("MaximumSize", MaximumSize, Size.Empty);
|
||||
sec.AddValue("MinimumSize", MinimumSize, Size.Empty);
|
||||
|
||||
sec.AddValue("Offset", Offset, Point.Empty);
|
||||
sec.AddValue("Rotation", Rotation, float.NaN);
|
||||
|
||||
sec.AddValue("ShowBaseValueLabels", ShowBaseValueLabels, Tbool.NotSet);
|
||||
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 "ConnectorColor":
|
||||
ConnectorColor = se.GetValueColor();
|
||||
break;
|
||||
|
||||
case "ConnectorLength":
|
||||
ConnectorLength = int.Parse(se.StringValue);
|
||||
break;
|
||||
|
||||
case "ConnectorPattern":
|
||||
ConnectorPattern = (LinePattern)se.GetValueEnum(typeof(LinePattern));
|
||||
break;
|
||||
|
||||
case "ConnectorThickness":
|
||||
ConnectorThickness = int.Parse(se.StringValue);
|
||||
break;
|
||||
|
||||
case "DrawConnector":
|
||||
DrawConnector = (Tbool)se.GetValueEnum(typeof(Tbool));
|
||||
break;
|
||||
|
||||
case "MaximumSize":
|
||||
MaximumSize = se.GetValueSize();
|
||||
break;
|
||||
|
||||
case "MinimumSize":
|
||||
MinimumSize = se.GetValueSize();
|
||||
break;
|
||||
|
||||
case "Offset":
|
||||
Offset = se.GetValuePoint();
|
||||
break;
|
||||
|
||||
case "Rotation":
|
||||
Rotation = float.Parse(se.StringValue);
|
||||
break;
|
||||
|
||||
case "ShowBaseValueLabels":
|
||||
ShowBaseValueLabels = (Tbool)se.GetValueEnum(typeof(Tbool));
|
||||
break;
|
||||
|
||||
case "TextFormat":
|
||||
TextFormat = se.StringValue;
|
||||
break;
|
||||
|
||||
default:
|
||||
base.ProcessValue(se);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the visual style of a Legend element.
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class SliceCenterLineVisualStyle : ChartLineVisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private int _InnerExtent;
|
||||
private int _OuterExtent;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region InnerExtent
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the distance (in pixels) to which the center line
|
||||
/// is extended prior to the slice inner radius.
|
||||
/// </summary>
|
||||
[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
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the distance (in pixels) to which the center line
|
||||
/// is extended past to the slice Outer radius.
|
||||
/// </summary>
|
||||
[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
|
||||
|
||||
/// <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 ((_InnerExtent == 0) &&
|
||||
(_OuterExtent == 0) &&
|
||||
(base.IsEmpty == true));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to the instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
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
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new SliceCenterLineVisualStyle Copy()
|
||||
{
|
||||
SliceCenterLineVisualStyle style = new SliceCenterLineVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
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
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,619 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines Thickness class.
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(ThicknessTypeConverter))]
|
||||
public class Thickness : IEquatable<Thickness>, IProcessSerialElement, INotifyPropertyChanged
|
||||
{
|
||||
#region Static data
|
||||
|
||||
/// <summary>
|
||||
/// Returns Empty instance of Thickness.
|
||||
/// </summary>
|
||||
public static Thickness Empty
|
||||
{
|
||||
get { return (new Thickness(0)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private variables
|
||||
|
||||
private int _Bottom;
|
||||
private int _Left;
|
||||
private int _Right;
|
||||
private int _Top;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Creates new instance of the object.
|
||||
/// </summary>
|
||||
/// <param name="left">Left thickness in pixels.</param>
|
||||
/// <param name="top">Top thickness in pixels.</param>
|
||||
/// <param name="right">Right thickness in pixels.</param>
|
||||
/// <param name="bottom">Bottom thickness in pixels.</param>
|
||||
public Thickness(int left, int top, int right, int bottom)
|
||||
{
|
||||
_Left = left;
|
||||
_Top = top;
|
||||
_Right = right;
|
||||
_Bottom = bottom;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates new instance of the object.
|
||||
/// </summary>
|
||||
/// <param name="all">Specifies uniform Thickness.</param>
|
||||
public Thickness(int all)
|
||||
: this(all, all, all, all)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates new instance of the object.
|
||||
/// </summary>
|
||||
public Thickness()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region All
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the thickness of all sides
|
||||
/// </summary>
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public int All
|
||||
{
|
||||
set { _Top = _Left = _Bottom = _Right = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Bottom
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Bottom thickness in pixels.
|
||||
/// </summary>
|
||||
[DefaultValue(0)]
|
||||
[Description("Indicates the Bottom thickness in pixels.")]
|
||||
public int Bottom
|
||||
{
|
||||
get { return (_Bottom); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Bottom != value)
|
||||
{
|
||||
_Bottom = value;
|
||||
|
||||
OnPropertyChanged(new VisualPropertyChangedEventArgs("Bottom"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Horizontal
|
||||
|
||||
/// <summary>
|
||||
/// Gets horizontal thickness (Left + Right)
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public int Horizontal
|
||||
{
|
||||
get { return (_Left + _Right); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Left
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the left thickness in pixels
|
||||
/// </summary>
|
||||
[DefaultValue(0)]
|
||||
[Description("Indicates the left thickness in pixels")]
|
||||
public int Left
|
||||
{
|
||||
get { return (_Left); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Left != value)
|
||||
{
|
||||
_Left = value;
|
||||
|
||||
OnPropertyChanged(new VisualPropertyChangedEventArgs("Left"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Right
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Right thickness in pixels
|
||||
/// </summary>
|
||||
[DefaultValue(0)]
|
||||
[Description("Indicates the Right thickness in pixels")]
|
||||
public int Right
|
||||
{
|
||||
get { return (_Right); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Right != value)
|
||||
{
|
||||
_Right = value;
|
||||
|
||||
OnPropertyChanged(new VisualPropertyChangedEventArgs("Right"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Top
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Top thickness in pixels
|
||||
/// </summary>
|
||||
[DefaultValue(0)]
|
||||
[Description("Indicates the Top thickness in pixels")]
|
||||
public int Top
|
||||
{
|
||||
get { return (_Top); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_Top != value)
|
||||
{
|
||||
_Top = value;
|
||||
|
||||
OnPropertyChanged(new VisualPropertyChangedEventArgs("Top"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Vertical
|
||||
|
||||
/// <summary>
|
||||
/// Gets vertical thickness (Top + Bottom)
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public int Vertical
|
||||
{
|
||||
get { return (_Top + _Bottom); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsEmpty
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the item is empty.
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public bool IsEmpty
|
||||
{
|
||||
get
|
||||
{
|
||||
return (_Left == 0 && _Right == 0 &&
|
||||
_Top == 0 && _Bottom == 0);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal properties
|
||||
|
||||
#region IsUniform
|
||||
|
||||
internal bool IsUniform
|
||||
{
|
||||
get
|
||||
{
|
||||
return (_Left == _Top &&
|
||||
_Left == _Right && _Left == _Bottom);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsZero
|
||||
|
||||
internal bool IsZero
|
||||
{
|
||||
get
|
||||
{
|
||||
return (_Left == 0 && _Top == 0 &&
|
||||
_Right == 0 && _Bottom == 0);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Size
|
||||
|
||||
internal Size Size
|
||||
{
|
||||
get { return (new Size(_Left + _Right, _Top + _Bottom)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Equals
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether two instances are equal.
|
||||
/// </summary>
|
||||
/// <param name="obj">Instance to compare to.</param>
|
||||
/// <returns>true if equal otherwise false.</returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is Thickness)
|
||||
return (this == (Thickness)obj);
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether two instances are equal.
|
||||
/// </summary>
|
||||
/// <param name="thickness">Instance to compare to</param>
|
||||
/// <returns>true if equal otherwise false</returns>
|
||||
public bool Equals(Thickness thickness)
|
||||
{
|
||||
return (this == thickness);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetHashCode
|
||||
|
||||
/// <summary>
|
||||
/// Returns hash-code.
|
||||
/// </summary>
|
||||
/// <returns>hash-code</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return (((_Left.GetHashCode() ^ _Top.GetHashCode()) ^
|
||||
_Right.GetHashCode()) ^ _Bottom.GetHashCode());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Operators
|
||||
|
||||
#region "==" operator
|
||||
|
||||
/// <summary>
|
||||
/// Implements == operator.
|
||||
/// </summary>
|
||||
/// <param name="t1">Object 1</param>
|
||||
/// <param name="t2">Object 2</param>
|
||||
/// <returns>true if equals</returns>
|
||||
public static bool operator ==(Thickness t1, Thickness t2)
|
||||
{
|
||||
if (ReferenceEquals(t1, t2))
|
||||
return (true);
|
||||
|
||||
if (((object)t1 == null) || ((object)t2 == null))
|
||||
return (false);
|
||||
|
||||
return (t1._Left == t2._Left && t1._Right == t2._Right &&
|
||||
t1._Top == t2._Top && t1._Bottom == t2._Bottom);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region "!=" operator
|
||||
|
||||
/// <summary>
|
||||
/// Implements != operator
|
||||
/// </summary>
|
||||
/// <param name="t1">Object 1</param>
|
||||
/// <param name="t2">Object 2</param>
|
||||
/// <returns>true if different</returns>
|
||||
public static bool operator !=(Thickness t1, Thickness t2)
|
||||
{
|
||||
return ((t1 == t2) == false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Creates an exact copy of the Thickness.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the Thickness.</returns>
|
||||
public Thickness Copy()
|
||||
{
|
||||
Thickness copy = new Thickness(_Left, _Top, _Right, _Bottom);
|
||||
|
||||
return (copy);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSerialData
|
||||
|
||||
internal virtual SerialElementCollection GetSerialData(string name)
|
||||
{
|
||||
SerialElementCollection sec = new SerialElementCollection();
|
||||
|
||||
sec.AddStartElement(name);
|
||||
|
||||
if (IsUniform == true)
|
||||
{
|
||||
sec.AddValue("All", Left, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
sec.AddValue("Left", Left, 0);
|
||||
sec.AddValue("Top", Top, 0);
|
||||
sec.AddValue("Right", Right, 0);
|
||||
sec.AddValue("Bottom", Bottom, 0);
|
||||
}
|
||||
|
||||
sec.AddEndElement(name);
|
||||
|
||||
return (sec);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PutSerialData
|
||||
|
||||
#region ProcessValue
|
||||
|
||||
void IProcessSerialElement.ProcessValue(SerialElement se)
|
||||
{
|
||||
ProcessValue(se);
|
||||
}
|
||||
|
||||
internal virtual void ProcessValue(SerialElement se)
|
||||
{
|
||||
switch (se.Name)
|
||||
{
|
||||
case "All":
|
||||
All = int.Parse(se.StringValue);
|
||||
break;
|
||||
|
||||
case "Left":
|
||||
Left = int.Parse(se.StringValue);
|
||||
break;
|
||||
|
||||
case "Top":
|
||||
Top = int.Parse(se.StringValue);
|
||||
break;
|
||||
|
||||
case "Right":
|
||||
Right = int.Parse(se.StringValue);
|
||||
break;
|
||||
|
||||
case "Bottom":
|
||||
Bottom = int.Parse(se.StringValue);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Exception("Unknown Serial Value (" + se.Name + ")");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ProcessCollection
|
||||
|
||||
void IProcessSerialElement.ProcessCollection(SerialElement se)
|
||||
{
|
||||
throw new Exception("Unknown Serial Collection (" + se.Name + ")");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region INotifyPropertyChanged Members
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when property value has changed.
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Raises the PropertyChanged event.
|
||||
/// </summary>
|
||||
/// <param name="e">Event arguments</param>
|
||||
void OnPropertyChanged(VisualPropertyChangedEventArgs e)
|
||||
{
|
||||
PropertyChangedEventHandler eh = PropertyChanged;
|
||||
|
||||
if (eh != null)
|
||||
eh(this, e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region ThicknessTypeConverter
|
||||
|
||||
///<summary>
|
||||
/// ThicknessTypeConverter
|
||||
///</summary>
|
||||
public class ThicknessTypeConverter : ExpandableObjectConverter
|
||||
{
|
||||
#region CanConvertTo
|
||||
|
||||
/// <summary>
|
||||
/// CanConvertTo
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="destinationType"></param>
|
||||
/// <returns></returns>
|
||||
public override bool CanConvertTo(
|
||||
ITypeDescriptorContext context, Type destinationType)
|
||||
{
|
||||
if (destinationType == typeof(string))
|
||||
return (true);
|
||||
|
||||
return (base.CanConvertTo(context, destinationType));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ConvertTo
|
||||
|
||||
/// <summary>
|
||||
/// ConvertTo
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="culture"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="destinationType"></param>
|
||||
/// <returns></returns>
|
||||
public override object ConvertTo(
|
||||
ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
|
||||
{
|
||||
if (destinationType == typeof(string))
|
||||
{
|
||||
Thickness t = value as Thickness;
|
||||
|
||||
if (t != null)
|
||||
{
|
||||
if (t.IsUniform == true)
|
||||
return (t.Left.ToString());
|
||||
|
||||
return (String.Format("{0:d}, {1:d}, {2:d}, {3:d}",
|
||||
t.Bottom, t.Left, t.Right, t.Top));
|
||||
}
|
||||
}
|
||||
|
||||
return (base.ConvertTo(context, culture, value, destinationType));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CanConvertFrom
|
||||
|
||||
/// <summary>
|
||||
/// CanConvertFrom
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="sourceType"></param>
|
||||
/// <returns></returns>
|
||||
public override bool CanConvertFrom(
|
||||
ITypeDescriptorContext context, Type sourceType)
|
||||
{
|
||||
if (sourceType == typeof(string))
|
||||
return (true);
|
||||
|
||||
return (base.CanConvertFrom(context, sourceType));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ConvertFrom
|
||||
|
||||
/// <summary>
|
||||
/// ConvertFrom
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="culture"></param>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public override object ConvertFrom(
|
||||
ITypeDescriptorContext context, CultureInfo culture, object value)
|
||||
{
|
||||
if (value is string)
|
||||
{
|
||||
string[] values = ((string)value).Split(',');
|
||||
|
||||
if (values.Length != 1 && values.Length != 4)
|
||||
throw new ArgumentException("Invalid value to convert.");
|
||||
|
||||
try
|
||||
{
|
||||
int[] v = new int[values.Length];
|
||||
|
||||
for (int i = 0; i < values.Length; i++)
|
||||
v[i] = int.Parse(values[i]);
|
||||
|
||||
Thickness t = (values.Length == 1)
|
||||
? new Thickness(v[0])
|
||||
: new Thickness(v[1], v[3], v[2], v[0]);
|
||||
|
||||
return (t);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw new ArgumentException("Invalid value to convert.");
|
||||
}
|
||||
}
|
||||
|
||||
return base.ConvertFrom(context, culture, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetCreateInstanceSupported
|
||||
|
||||
/// <summary>
|
||||
/// GetCreateInstanceSupported
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <returns></returns>
|
||||
public override bool GetCreateInstanceSupported(ITypeDescriptorContext context)
|
||||
{
|
||||
return (true);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CreateInstance
|
||||
|
||||
/// <summary>
|
||||
/// CreateInstance
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="propertyValues"></param>
|
||||
/// <returns></returns>
|
||||
public override object CreateInstance(
|
||||
ITypeDescriptorContext context, IDictionary propertyValues)
|
||||
{
|
||||
return (new Thickness((int)propertyValues["Left"], (int)propertyValues["Top"],
|
||||
(int)propertyValues["Right"], (int)propertyValues["Bottom"]));
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,444 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the visual style of a Tickmark Label element.
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class TickmarkLabelVisualStyle : BaseVisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private Font _Font;
|
||||
|
||||
private Tbool _AllowWrap = Tbool.NotSet;
|
||||
|
||||
private Color _TextColor = Color.Empty;
|
||||
private Alignment _TextAlignment = Alignment.NotSet;
|
||||
private string _TextFormat;
|
||||
|
||||
private int _MaxLineCount = -1;
|
||||
private int _MaxWidth = -1;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public properties
|
||||
|
||||
#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 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 MaxLineCount
|
||||
|
||||
/// <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 MaxLineCount
|
||||
{
|
||||
get { return (_MaxLineCount); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _MaxLineCount)
|
||||
{
|
||||
_MaxLineCount = value;
|
||||
|
||||
OnPropertyChangedEx("MaxLineCount", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region MaxWidth
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum width of the lable.
|
||||
/// </summary>
|
||||
[DefaultValue(-1), Category("Appearance")]
|
||||
[Description("Indicates the maximum width of the lable.")]
|
||||
public int MaxWidth
|
||||
{
|
||||
get { return (_MaxWidth); }
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _MaxWidth)
|
||||
{
|
||||
_MaxWidth = value;
|
||||
|
||||
OnPropertyChangedEx("MaxWidth", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region TextAlignment
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the alignment of the axis Text
|
||||
/// </summary>
|
||||
[DefaultValue(Alignment.NotSet), Category("Appearance")]
|
||||
[Description("Indicates the alignment of the axis Text.")]
|
||||
public Alignment TextAlignment
|
||||
{
|
||||
get { return (_TextAlignment); }
|
||||
|
||||
set
|
||||
{
|
||||
if (_TextAlignment != value)
|
||||
{
|
||||
_TextAlignment = value;
|
||||
|
||||
OnPropertyChangedEx("TextAlignment", 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 TextFormat
|
||||
|
||||
/// <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.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#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 ((_AllowWrap == Tbool.NotSet) &&
|
||||
(_Font == null) &&
|
||||
(_MaxLineCount < 0) &&
|
||||
(_MaxWidth < 0) &&
|
||||
(_TextAlignment == Alignment.NotSet) &&
|
||||
(_TextColor.IsEmpty == true) &&
|
||||
(string.IsNullOrEmpty(_TextFormat) == true) &&
|
||||
(base.IsEmpty == true));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetTextFormatFlags
|
||||
|
||||
internal eTextFormat GetTextFormatFlags()
|
||||
{
|
||||
eTextFormat tf = eTextFormat.WordEllipsis |
|
||||
eTextFormat.NoPadding | eTextFormat.NoPrefix;
|
||||
|
||||
if (AllowWrap == Tbool.True)
|
||||
tf |= eTextFormat.WordBreak;
|
||||
|
||||
tf |= eTextFormat.HorizontalCenter | eTextFormat.VerticalCenter;
|
||||
|
||||
return (tf);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetStringFormatFlags
|
||||
|
||||
internal void GetStringFormatFlags(StringFormat sf)
|
||||
{
|
||||
if (AllowWrap == Tbool.False)
|
||||
sf.FormatFlags |= StringFormatFlags.NoWrap;
|
||||
|
||||
sf.LineAlignment = StringAlignment.Center;
|
||||
sf.Alignment = StringAlignment.Center;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(TickmarkLabelVisualStyle style)
|
||||
{
|
||||
if (style != null)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style.AllowWrap != Tbool.NotSet)
|
||||
AllowWrap = style.AllowWrap;
|
||||
|
||||
if (style.Font != null)
|
||||
Font = style.Font;
|
||||
|
||||
if (style.MaxLineCount > 0)
|
||||
MaxLineCount = style.MaxLineCount;
|
||||
|
||||
if (style.MaxWidth > 0)
|
||||
MaxWidth = style.MaxWidth;
|
||||
|
||||
if (style.TextAlignment != Alignment.NotSet)
|
||||
TextAlignment = style.TextAlignment;
|
||||
|
||||
if (style.TextColor.IsEmpty == false)
|
||||
TextColor = style.TextColor;
|
||||
|
||||
if (string.IsNullOrEmpty(style.TextFormat) == false)
|
||||
TextFormat = style.TextFormat;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new TickmarkLabelVisualStyle Copy()
|
||||
{
|
||||
TickmarkLabelVisualStyle style = new TickmarkLabelVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(TickmarkLabelVisualStyle style)
|
||||
{
|
||||
base.CopyTo(style);
|
||||
|
||||
style.AllowWrap = _AllowWrap;
|
||||
|
||||
style.Font = (_Font != null) ? (Font)_Font.Clone() : null;
|
||||
|
||||
style.MaxLineCount = _MaxLineCount;
|
||||
style.MaxWidth = _MaxWidth;
|
||||
|
||||
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 = "TickmarkLabelVisualStyle";
|
||||
|
||||
sec.AddStartElement(serialName);
|
||||
}
|
||||
|
||||
sec.AddValue("AllowWrap", AllowWrap, Tbool.NotSet);
|
||||
|
||||
if (_Font != null)
|
||||
sec.AddValue("Font", XmlSerializableFont.ConvertToString(Font));
|
||||
|
||||
sec.AddValue("MaxLineCount", MaxLineCount, -1);
|
||||
sec.AddValue("MaxWidth", MaxWidth, -1);
|
||||
|
||||
sec.AddValue("TextAlignment", TextAlignment, Alignment.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 "AllowWrap":
|
||||
AllowWrap = (Tbool)se.GetValueEnum(typeof(Tbool));
|
||||
break;
|
||||
|
||||
case "Font":
|
||||
Font = XmlSerializableFont.ConvertFromString(se.StringValue);
|
||||
break;
|
||||
|
||||
case "MaxLineCount":
|
||||
MaxLineCount = int.Parse(se.StringValue);
|
||||
break;
|
||||
|
||||
case "MaxWidth":
|
||||
MaxWidth = int.Parse(se.StringValue);
|
||||
break;
|
||||
|
||||
case "TextAlignment":
|
||||
TextAlignment = (Alignment)se.GetValueEnum(typeof(Alignment));
|
||||
break;
|
||||
|
||||
case "TextColor":
|
||||
TextColor = se.GetValueColor();
|
||||
break;
|
||||
|
||||
case "TextFormat":
|
||||
TextFormat = se.StringValue;
|
||||
break;
|
||||
|
||||
default:
|
||||
base.ProcessValue(se);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the visual style of a TrendLine Indicator element.
|
||||
/// </summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class TrendLineVisualStyle : ChartCapLineVisualStyle
|
||||
{
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new TrendLineVisualStyle Copy()
|
||||
{
|
||||
TrendLineVisualStyle style = new TrendLineVisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(TrendLineVisualStyle style)
|
||||
{
|
||||
base.CopyTo(style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,986 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the visual style.
|
||||
/// </summary>
|
||||
[ToolboxItem(false), DesignTimeVisible(false)]
|
||||
[TypeConverter(typeof(ExpandableObjectConverter))]
|
||||
public class VisualStyle : BaseVisualStyle
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private Background _Background;
|
||||
private BorderColor _BorderColor;
|
||||
private BorderPattern _BorderPattern;
|
||||
private Thickness _BorderThickness;
|
||||
|
||||
private Color _TextColor = Color.Empty;
|
||||
|
||||
private Padding _Margin;
|
||||
private Padding _Padding;
|
||||
|
||||
private Font _Font;
|
||||
|
||||
#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 BorderColor BorderColor
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_BorderColor == null)
|
||||
{
|
||||
_BorderColor = BorderColor.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _BorderColor);
|
||||
}
|
||||
|
||||
return (_BorderColor);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_BorderColor != value)
|
||||
{
|
||||
UpdateChangeHandler(_BorderColor, value);
|
||||
|
||||
_BorderColor = value;
|
||||
|
||||
OnPropertyChangedEx("BorderColor", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeBorderColor()
|
||||
{
|
||||
return (_BorderColor != null && _BorderColor.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetBorderColor()
|
||||
{
|
||||
BorderColor = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BorderPattern
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the style border pattern (Solid, Dash, ...)
|
||||
/// </summary>
|
||||
[Description("Indicates the style border pattern (Solid, Dash, ...)")]
|
||||
public BorderPattern BorderPattern
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_BorderPattern == null)
|
||||
{
|
||||
_BorderPattern = BorderPattern.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _BorderPattern);
|
||||
}
|
||||
|
||||
return (_BorderPattern);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_BorderPattern != value)
|
||||
{
|
||||
UpdateChangeHandler(_BorderPattern, value);
|
||||
|
||||
_BorderPattern = value;
|
||||
|
||||
OnPropertyChangedEx("BorderPattern", VisualChangeType.Render);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeBorderPattern()
|
||||
{
|
||||
return (_BorderPattern != null && _BorderPattern.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetBorderPattern()
|
||||
{
|
||||
BorderPattern = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BorderThickness
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the style border thickness.
|
||||
/// </summary>
|
||||
[Description("Indicates the style border thickness")]
|
||||
public Thickness BorderThickness
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_BorderThickness == null)
|
||||
{
|
||||
_BorderThickness = Thickness.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _BorderThickness);
|
||||
}
|
||||
|
||||
return (_BorderThickness);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_BorderThickness != value)
|
||||
{
|
||||
UpdateChangeHandler(_BorderThickness, value);
|
||||
|
||||
_BorderThickness = value;
|
||||
|
||||
OnPropertyChangedEx("BorderThickness", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeBorderThickness()
|
||||
{
|
||||
return (_BorderThickness != null && _BorderThickness.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetBorderThickness()
|
||||
{
|
||||
BorderThickness = null;
|
||||
}
|
||||
|
||||
#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 Margin
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the spacing between the border and outside content.
|
||||
/// </summary>
|
||||
[Description("Indicates the spacing between the border and outside content")]
|
||||
public Padding Margin
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_Margin == null)
|
||||
{
|
||||
_Margin = Padding.Empty;
|
||||
|
||||
UpdateChangeHandler(null, _Margin);
|
||||
}
|
||||
|
||||
return (_Margin);
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (_Margin != value)
|
||||
{
|
||||
UpdateChangeHandler(_Margin, value);
|
||||
|
||||
_Margin = value;
|
||||
|
||||
OnPropertyChangedEx("Margin", VisualChangeType.Layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether property should be serialized.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private bool ShouldSerializeMargin()
|
||||
{
|
||||
return (_Margin != null && _Margin.IsEmpty == false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets property to its default value.
|
||||
/// </summary>
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
private void ResetMargin()
|
||||
{
|
||||
Margin = null;
|
||||
}
|
||||
|
||||
#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 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 ((_Background == null || _Background.IsEmpty == true) &&
|
||||
(_BorderColor == null || _BorderColor.IsEmpty == true) &&
|
||||
(_BorderPattern == null || _BorderPattern.IsEmpty == true) &&
|
||||
(_BorderThickness == null || _BorderThickness.IsEmpty == true) &&
|
||||
(_Margin == null || _Margin.IsEmpty == true) &&
|
||||
(_Padding == null || _Padding.IsEmpty == true) &&
|
||||
(_Font == null) &&
|
||||
(_TextColor.IsEmpty == true) &&
|
||||
(base.IsEmpty == true)); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region RenderBackground
|
||||
|
||||
internal void RenderBackground(Graphics g, Rectangle bounds)
|
||||
{
|
||||
if (bounds.Width > 1 && bounds.Height > 1)
|
||||
{
|
||||
using (Brush br = Background.GetBrush(bounds))
|
||||
{
|
||||
if (br != null)
|
||||
g.FillRectangle(br, bounds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region RenderBorder
|
||||
|
||||
internal void RenderBorder(Graphics g, Rectangle r)
|
||||
{
|
||||
RenderBorderEx(g, r, BorderPattern, BorderThickness, BorderColor);
|
||||
}
|
||||
|
||||
internal void RenderBorderEx(Graphics g, Rectangle r,
|
||||
BorderPattern borderPattern, Thickness borderThickness, BorderColor borderColor)
|
||||
{
|
||||
if (r.Width > 2 && r.Height > 2)
|
||||
{
|
||||
if (borderPattern == null || borderThickness == null || borderColor == null)
|
||||
return;
|
||||
|
||||
SmoothingMode sm = g.SmoothingMode;
|
||||
g.SmoothingMode = SmoothingMode.None;
|
||||
|
||||
if (borderColor.IsUniform == true &&
|
||||
borderThickness.IsUniform == true && borderPattern.IsUniform == true)
|
||||
{
|
||||
RenderUniformBorder(g, r, borderPattern, borderThickness, borderColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
RenderVariableBorder(g, r, borderPattern, borderThickness, borderColor);
|
||||
}
|
||||
|
||||
g.SmoothingMode = sm;
|
||||
}
|
||||
}
|
||||
|
||||
#region RenderUniformBorder
|
||||
|
||||
private void RenderUniformBorder(Graphics g, Rectangle r,
|
||||
BorderPattern borderPattern, Thickness borderThickness, BorderColor borderColor)
|
||||
{
|
||||
if (borderPattern.Top != LinePattern.None &&
|
||||
(borderThickness.Top > 0 && borderColor.Top.IsEmpty == false))
|
||||
{
|
||||
using (Pen pen = new
|
||||
Pen(borderColor.Top, Dpi.Width(borderThickness.Top)))
|
||||
{
|
||||
LinePattern pattern = (borderPattern.Top == LinePattern.NotSet)
|
||||
? LinePattern.Solid : borderPattern.Top;
|
||||
|
||||
if (borderThickness.Top > 1)
|
||||
{
|
||||
pen.Alignment = PenAlignment.Inset;
|
||||
}
|
||||
else
|
||||
{
|
||||
r.Width--;
|
||||
r.Height--;
|
||||
}
|
||||
|
||||
pen.DashStyle = (DashStyle)pattern;
|
||||
|
||||
g.DrawRectangle(pen, r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region RenderVariableBorder
|
||||
|
||||
private void RenderVariableBorder(Graphics g, Rectangle r,
|
||||
BorderPattern borderPattern, Thickness borderThickness, BorderColor borderColor)
|
||||
{
|
||||
Pen[] pens = GetBorderPens(borderPattern, borderThickness, borderColor);
|
||||
|
||||
if (pens[(int)BorderSide.Left] != null)
|
||||
{
|
||||
int n = (int)Math.Floor((double)borderThickness.Left / 2);
|
||||
int left = r.Left + n;
|
||||
|
||||
g.DrawLine(pens[(int)BorderSide.Left], left, r.Top, left, r.Bottom - 1);
|
||||
}
|
||||
|
||||
if (pens[(int)BorderSide.Right] != null)
|
||||
{
|
||||
int n = (int)Math.Ceiling((double)borderThickness.Right / 2);
|
||||
int right = r.Right - n;
|
||||
|
||||
g.DrawLine(pens[(int)BorderSide.Right], right, r.Top, right, r.Bottom);
|
||||
}
|
||||
|
||||
if (pens[(int)BorderSide.Top] != null)
|
||||
{
|
||||
int n = (int)Math.Floor((double)borderThickness.Top / 2);
|
||||
int top = r.Top + n;
|
||||
|
||||
g.DrawLine(pens[(int)BorderSide.Top], r.X, top, r.Right - 1, top);
|
||||
}
|
||||
|
||||
if (pens[(int)BorderSide.Bottom] != null)
|
||||
{
|
||||
int n = (int)Math.Ceiling((double)borderThickness.Bottom / 2);
|
||||
int bottom = r.Bottom - n;
|
||||
|
||||
g.DrawLine(pens[(int)BorderSide.Bottom], r.X, bottom, r.Right, bottom);
|
||||
}
|
||||
|
||||
foreach (Pen pen in pens)
|
||||
{
|
||||
if (pen != null)
|
||||
pen.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
#region GetBorderPens
|
||||
|
||||
internal Pen[] GetBorderPens(
|
||||
BorderPattern borderPattern, Thickness borderThickness, BorderColor borderColor)
|
||||
{
|
||||
Pen[] pens = new Pen[4];
|
||||
|
||||
pens[(int)BorderSide.Top] = GetBorderPen(pens,
|
||||
borderColor.Top, borderThickness.Top, borderPattern.Top);
|
||||
|
||||
pens[(int)BorderSide.Left] = GetBorderPen(pens,
|
||||
borderColor.Left, borderThickness.Left, borderPattern.Left);
|
||||
|
||||
pens[(int)BorderSide.Bottom] = GetBorderPen(pens,
|
||||
borderColor.Bottom, borderThickness.Bottom, borderPattern.Bottom);
|
||||
|
||||
pens[(int)BorderSide.Right] = GetBorderPen(pens,
|
||||
borderColor.Right, borderThickness.Right, borderPattern.Right);
|
||||
|
||||
return (pens);
|
||||
}
|
||||
|
||||
#region GetBorderPen
|
||||
|
||||
private Pen GetBorderPen(IEnumerable<Pen> pens,
|
||||
Color color, int width, LinePattern pattern)
|
||||
{
|
||||
if (color.IsEmpty == true ||
|
||||
pattern == LinePattern.None || width <= 0)
|
||||
{
|
||||
return (null);
|
||||
}
|
||||
|
||||
width = Dpi.Width(width);
|
||||
|
||||
foreach (Pen pen in pens)
|
||||
{
|
||||
if (pen != null)
|
||||
{
|
||||
if (pen.Color == color && pen.Width == width &&
|
||||
pen.DashStyle == (DashStyle)pattern)
|
||||
{
|
||||
return (pen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Pen npen = new Pen(color, width);
|
||||
|
||||
if (pattern == LinePattern.NotSet)
|
||||
pattern = LinePattern.Solid;
|
||||
|
||||
npen.DashStyle = (DashStyle)pattern;
|
||||
|
||||
return (npen);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetBorderSize
|
||||
|
||||
internal Size GetBorderSize(bool inclPadding)
|
||||
{
|
||||
Size size = Size.Empty;
|
||||
|
||||
size.Width += (BorderThickness.Horizontal + Margin.Horizontal);
|
||||
size.Height += (BorderThickness.Vertical + Margin.Vertical);
|
||||
|
||||
if (inclPadding == true)
|
||||
{
|
||||
size.Width += Padding.Horizontal;
|
||||
size.Height += Padding.Vertical;
|
||||
}
|
||||
|
||||
return (size);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyStyle
|
||||
|
||||
/// <summary>
|
||||
/// Applies the style to instance of this style.
|
||||
/// </summary>
|
||||
/// <param name="style">Style to apply.</param>
|
||||
public void ApplyStyle(VisualStyle style)
|
||||
{
|
||||
base.ApplyStyle(style);
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
if (style._Background != null && style._Background.IsEmpty == false)
|
||||
Background = style._Background.Copy();
|
||||
|
||||
if (style._BorderColor != null && style._BorderColor.IsEmpty == false)
|
||||
BorderColor = style._BorderColor.Copy();
|
||||
|
||||
if (style._BorderPattern != null && style._BorderPattern.IsEmpty == false)
|
||||
BorderPattern.ApplyPattern(style._BorderPattern);
|
||||
|
||||
if (style._BorderThickness != null && style._BorderThickness.IsZero == false)
|
||||
BorderThickness = style._BorderThickness.Copy();
|
||||
|
||||
if (style.Font != null)
|
||||
Font = style.Font;
|
||||
|
||||
if (style._Margin != null && style._Margin.IsEmpty == false)
|
||||
Margin = style.Margin.Copy();
|
||||
|
||||
if (style._Padding != null && style._Padding.IsEmpty == false)
|
||||
Padding = style.Padding.Copy();
|
||||
|
||||
if (style._TextColor.IsEmpty == false)
|
||||
TextColor = style._TextColor;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ApplyDefaults
|
||||
|
||||
private Background _DefaultBackground = new Background(Color.Transparent);
|
||||
|
||||
public override void ApplyDefaults()
|
||||
{
|
||||
base.ApplyDefaults();
|
||||
|
||||
if (_TextColor.IsEmpty == true)
|
||||
TextColor = Color.Black;
|
||||
|
||||
if (Font == null)
|
||||
Font = SystemFonts.DefaultFont;
|
||||
|
||||
if (Background == null)
|
||||
Background = _DefaultBackground;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Copy
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public new VisualStyle Copy()
|
||||
{
|
||||
VisualStyle style = new VisualStyle();
|
||||
|
||||
CopyTo(style);
|
||||
|
||||
return (style);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region CopyTo
|
||||
|
||||
/// <summary>
|
||||
/// Returns the copy of the style.
|
||||
/// </summary>
|
||||
/// <returns>Copy of the style.</returns>
|
||||
public void CopyTo(VisualStyle style)
|
||||
{
|
||||
base.CopyTo(style);
|
||||
|
||||
style.Background = (_Background == null) ? null : _Background.Copy();
|
||||
style.BorderColor = (_BorderColor == null) ? null : _BorderColor.Copy();
|
||||
style.BorderPattern = (_BorderPattern == null) ? null : _BorderPattern.Copy();
|
||||
style.BorderThickness = (_BorderThickness == null) ? null : _BorderThickness.Copy();
|
||||
style.Font = (_Font == null) ? null : (Font)_Font.Clone();
|
||||
style.Margin = (_Margin == null) ? null : _Margin.Copy();
|
||||
style.Padding = (_Padding == null) ? null : _Padding.Copy();
|
||||
style.TextColor = _TextColor;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSerialData
|
||||
|
||||
internal override SerialElementCollection GetSerialData(string serialName)
|
||||
{
|
||||
SerialElementCollection sec = new SerialElementCollection();
|
||||
|
||||
if (serialName != null)
|
||||
{
|
||||
if (serialName.Equals("") == true)
|
||||
serialName = "VisualStyle";
|
||||
|
||||
sec.AddStartElement(serialName);
|
||||
}
|
||||
|
||||
if (_Background != null && _Background.IsEmpty == false)
|
||||
sec.AddElement(_Background.GetSerialData("Background"));
|
||||
|
||||
if (_BorderColor != null && _BorderColor.IsEmpty == false)
|
||||
sec.AddElement(_BorderColor.GetSerialData("BorderColor"));
|
||||
|
||||
if (_BorderPattern != null && _BorderPattern.IsEmpty == false)
|
||||
sec.AddElement(_BorderPattern.GetSerialData("BorderPattern"));
|
||||
|
||||
if (_BorderThickness != null && _BorderThickness.IsEmpty == false)
|
||||
sec.AddElement(_BorderThickness.GetSerialData("BorderThickness"));
|
||||
|
||||
if (_Font != null)
|
||||
sec.AddValue("Font", XmlSerializableFont.ConvertToString(_Font));
|
||||
|
||||
if (_Margin != null && _Margin.IsEmpty == false)
|
||||
sec.AddElement(_Margin.GetSerialData("Margin"));
|
||||
|
||||
if (_Padding != null && _Padding.IsEmpty == false)
|
||||
sec.AddElement(_Padding.GetSerialData("Padding"));
|
||||
|
||||
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 "TextColor":
|
||||
TextColor = se.GetValueColor();
|
||||
break;
|
||||
|
||||
case "Font":
|
||||
Font = XmlSerializableFont.ConvertFromString(se.StringValue);
|
||||
break;
|
||||
|
||||
default:
|
||||
base.ProcessValue(se);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ProcessCollection
|
||||
|
||||
internal override void ProcessCollection(SerialElement se)
|
||||
{
|
||||
switch (se.Name)
|
||||
{
|
||||
case "Background":
|
||||
se.Sec.PutSerialData(Background);
|
||||
break;
|
||||
|
||||
case "BorderColor":
|
||||
se.Sec.PutSerialData(BorderColor);
|
||||
break;
|
||||
|
||||
case "BorderPattern":
|
||||
se.Sec.PutSerialData(BorderPattern);
|
||||
break;
|
||||
|
||||
case "BorderThickness":
|
||||
se.Sec.PutSerialData(BorderThickness);
|
||||
break;
|
||||
|
||||
case "Margin":
|
||||
se.Sec.PutSerialData(Margin);
|
||||
break;
|
||||
|
||||
case "Padding":
|
||||
se.Sec.PutSerialData(Padding);
|
||||
break;
|
||||
|
||||
default:
|
||||
base.ProcessCollection(se);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public override void Dispose()
|
||||
{
|
||||
Background = null;
|
||||
BorderColor = null;
|
||||
BorderPattern = null;
|
||||
BorderThickness = null;
|
||||
Margin = null;
|
||||
Padding = null;
|
||||
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region Alignment
|
||||
|
||||
///<summary>
|
||||
/// Alignment of the content
|
||||
///</summary>
|
||||
public enum Alignment
|
||||
{
|
||||
///<summary>
|
||||
///</summary>
|
||||
NotSet = -1,
|
||||
|
||||
///<summary>
|
||||
/// TopLeft
|
||||
///</summary>
|
||||
TopLeft,
|
||||
|
||||
///<summary>
|
||||
/// TopCenter
|
||||
///</summary>
|
||||
TopCenter,
|
||||
|
||||
///<summary>
|
||||
/// TopRight
|
||||
///</summary>
|
||||
TopRight,
|
||||
|
||||
///<summary>
|
||||
/// MiddleLeft
|
||||
///</summary>
|
||||
MiddleLeft,
|
||||
|
||||
///<summary>
|
||||
/// MiddleCenter
|
||||
///</summary>
|
||||
MiddleCenter,
|
||||
|
||||
/// <summary>
|
||||
/// MiddleRight
|
||||
/// </summary>
|
||||
MiddleRight,
|
||||
|
||||
/// <summary>
|
||||
/// BottomLeft
|
||||
/// </summary>
|
||||
BottomLeft,
|
||||
|
||||
/// <summary>
|
||||
/// BottomCenter
|
||||
/// </summary>
|
||||
BottomCenter,
|
||||
|
||||
/// <summary>
|
||||
/// BottomRight
|
||||
/// </summary>
|
||||
BottomRight,
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region LineAlignment
|
||||
|
||||
///<summary>
|
||||
/// LineAlignment of the content
|
||||
///</summary>
|
||||
public enum LineAlignment
|
||||
{
|
||||
///<summary>
|
||||
/// Not Set
|
||||
///</summary>
|
||||
NotSet = -1,
|
||||
|
||||
///<summary>
|
||||
/// Near
|
||||
///</summary>
|
||||
Near,
|
||||
|
||||
///<summary>
|
||||
/// Center
|
||||
///</summary>
|
||||
Center,
|
||||
|
||||
///<summary>
|
||||
/// Far
|
||||
///</summary>
|
||||
Far,
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region BorderSide
|
||||
|
||||
internal enum BorderSide
|
||||
{
|
||||
Top,
|
||||
Left,
|
||||
Bottom,
|
||||
Right
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,429 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace DevComponents.DotNetBar.Charts.Style
|
||||
{
|
||||
///<summary>
|
||||
/// VisualStyles
|
||||
///</summary>
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
public class VisualStyles<T> : IDisposable, INotifyPropertyChanged, IProcessSerialElement
|
||||
where T : BaseVisualStyle, new()
|
||||
{
|
||||
#region Private variables
|
||||
|
||||
private T[] _Styles;
|
||||
|
||||
#endregion
|
||||
|
||||
///<summary>
|
||||
/// Constructor
|
||||
///</summary>
|
||||
public VisualStyles()
|
||||
{
|
||||
_Styles = new T[Enum.GetValues(typeof(StyleType)).Length - 1];
|
||||
}
|
||||
|
||||
#region Public properties
|
||||
|
||||
#region Indexer
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the visual style
|
||||
/// assigned to the element. Default value is null.
|
||||
/// </summary>
|
||||
[DefaultValue(null), Category("Style")]
|
||||
[Description("Indicates visual style assigned to the element")]
|
||||
public T this[StyleType e]
|
||||
{
|
||||
get
|
||||
{
|
||||
int n = StyleIndex(e);
|
||||
|
||||
return (GetStyle(n));
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
int n = StyleIndex(e);
|
||||
|
||||
SetStyle(n, value);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Default
|
||||
|
||||
///<summary>
|
||||
/// The normal, default style
|
||||
///</summary>
|
||||
[Description("Style to use for normal, default items")]
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public T Default
|
||||
{
|
||||
get { return (GetStyle((int) StyleType.Default)); }
|
||||
set { SetStyle((int) StyleType.Default, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region MouseOver
|
||||
|
||||
///<summary>
|
||||
/// MouseOver
|
||||
///</summary>
|
||||
[Description("Style to use when the Mouse is over an item")]
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public T MouseOver
|
||||
{
|
||||
get { return (GetStyle((int)StyleType.MouseOver)); }
|
||||
set { SetStyle((int)StyleType.MouseOver, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Selected
|
||||
|
||||
///<summary>
|
||||
/// Selected
|
||||
///</summary>
|
||||
[Description("Style to use when the item is selected")]
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public T Selected
|
||||
{
|
||||
get { return (GetStyle((int)StyleType.Selected)); }
|
||||
set { SetStyle((int)StyleType.Selected, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SelectedMouseOver
|
||||
|
||||
///<summary>
|
||||
/// MouseOver
|
||||
///</summary>
|
||||
[Description("Style to use when the item is selected and the Mouse is over it")]
|
||||
[TypeConverter(typeof(VisualStylesConverter))]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public T SelectedMouseOver
|
||||
{
|
||||
get { return (GetStyle((int)StyleType.SelectedMouseOver)); }
|
||||
set { SetStyle((int)StyleType.SelectedMouseOver, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Styles
|
||||
|
||||
///<summary>
|
||||
/// Styles array
|
||||
///</summary>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
public T[] Styles
|
||||
{
|
||||
get { return (_Styles); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsEmpty
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the style collection is logically Empty.
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||
[Description("Gets whether the style collection is logically Empty.")]
|
||||
public bool IsEmpty
|
||||
{
|
||||
get
|
||||
{
|
||||
for (int i = 0; i < Styles.Length; i++)
|
||||
{
|
||||
T vstyle = Styles[i];
|
||||
|
||||
if (vstyle != null && vstyle.IsEmpty == false)
|
||||
return (false);
|
||||
}
|
||||
|
||||
return (true);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Count
|
||||
|
||||
internal int Count
|
||||
{
|
||||
get { return (_Styles.Length); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetStyle
|
||||
|
||||
internal T GetStyle(int n)
|
||||
{
|
||||
if (_Styles[n] == null)
|
||||
{
|
||||
_Styles[n] = new T();
|
||||
|
||||
OnStyleChangeHandler(null, _Styles[n]);
|
||||
}
|
||||
|
||||
return (_Styles[n]);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region SetStyle
|
||||
|
||||
internal void SetStyle(int n, T value)
|
||||
{
|
||||
if (_Styles[n] != value)
|
||||
{
|
||||
T oldValue = _Styles[n];
|
||||
|
||||
_Styles[n] = value;
|
||||
|
||||
OnStyleChanged(Enum.GetName(typeof(StyleType), n), oldValue, value);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetSerialData
|
||||
|
||||
internal SerialElementCollection GetSerialData(string serialName)
|
||||
{
|
||||
if (IsEmpty == false)
|
||||
{
|
||||
SerialElementCollection sec = new SerialElementCollection();
|
||||
|
||||
if (serialName != null)
|
||||
{
|
||||
if (serialName.Equals("") == true)
|
||||
{
|
||||
serialName = this.ToString();
|
||||
|
||||
serialName = serialName.Substring(serialName.LastIndexOf('.') + 1);
|
||||
}
|
||||
|
||||
sec.AddStartElement(serialName);
|
||||
}
|
||||
|
||||
string[] enums = Enum.GetNames(typeof(StyleType));
|
||||
|
||||
for (int i = 0; i < Styles.Length; i++)
|
||||
{
|
||||
T vstyle = Styles[i];
|
||||
|
||||
if (vstyle != null && vstyle.IsEmpty == false)
|
||||
{
|
||||
sec.AddStartElement(enums[i]);
|
||||
sec.AddElement(vstyle.GetSerialData(null));
|
||||
sec.AddEndElement(enums[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (serialName != null)
|
||||
sec.AddEndElement(serialName);
|
||||
|
||||
return (sec);
|
||||
}
|
||||
|
||||
return (null);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PutSerialData
|
||||
|
||||
#region ProcessValue
|
||||
|
||||
void IProcessSerialElement.ProcessValue(SerialElement se)
|
||||
{
|
||||
throw new Exception("Unknown Serial Value (" + se.Name + ")");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ProcessCollection
|
||||
|
||||
void IProcessSerialElement.ProcessCollection(SerialElement se)
|
||||
{
|
||||
switch (se.Name)
|
||||
{
|
||||
case "Default":
|
||||
se.Sec.PutSerialData(Default);
|
||||
break;
|
||||
|
||||
case "MouseOver":
|
||||
se.Sec.PutSerialData(MouseOver);
|
||||
break;
|
||||
|
||||
case "Selected":
|
||||
se.Sec.PutSerialData(Selected);
|
||||
break;
|
||||
|
||||
case "SelectedMouseOver":
|
||||
se.Sec.PutSerialData(SelectedMouseOver);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Exception("Unknown Serial Collection (" + se.Name + ")");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region OnStyleChanged
|
||||
|
||||
private void OnStyleChanged(
|
||||
string property, T oldValue, T newValue)
|
||||
{
|
||||
OnStyleChangeHandler(oldValue, newValue);
|
||||
|
||||
OnPropertyChanged(new VisualPropertyChangedEventArgs(property));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StyleIndex
|
||||
|
||||
internal int StyleIndex(Enum e)
|
||||
{
|
||||
int n = ((IConvertible)e).ToInt32(null);
|
||||
|
||||
if (n < 0 || n > _Styles.Length)
|
||||
throw new Exception("Invalid Style indexer");
|
||||
|
||||
return (n);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IsValid
|
||||
|
||||
internal T Style(Enum e)
|
||||
{
|
||||
int n = ((IConvertible) e).ToInt32(null);
|
||||
|
||||
if (n < 0 || n > _Styles.Length)
|
||||
throw new Exception("Invalid Style indexer");
|
||||
|
||||
return (_Styles[n]);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetStyleType
|
||||
|
||||
internal StyleType GetStyleType(StyleState state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case StyleState.MouseOver:
|
||||
return (StyleType.MouseOver);
|
||||
|
||||
case StyleState.Selected:
|
||||
return (StyleType.Selected);
|
||||
|
||||
case StyleState.Selected | StyleState.MouseOver:
|
||||
return (StyleType.SelectedMouseOver);
|
||||
|
||||
default:
|
||||
return (StyleType.Default);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Style support routines
|
||||
|
||||
#region StyleVisualChangeHandler
|
||||
|
||||
private void OnStyleChangeHandler(T oldValue, T newValue)
|
||||
{
|
||||
if (oldValue != null)
|
||||
oldValue.PropertyChanged -= StyleChanged;
|
||||
|
||||
if (newValue != null)
|
||||
newValue.PropertyChanged += StyleChanged;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region StyleChanged
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when one of element visual styles has property changes.
|
||||
/// Default implementation invalidates visual appearance of element.
|
||||
/// </summary>
|
||||
/// <param name="sender">VisualStyle that changed.</param>
|
||||
/// <param name="e">Event arguments.</param>
|
||||
protected virtual void StyleChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
OnPropertyChanged(e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region INotifyPropertyChanged Members
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when property value has changed.
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Raises the PropertyChanged event.
|
||||
/// </summary>
|
||||
/// <param name="e">Event arguments</param>
|
||||
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
|
||||
{
|
||||
PropertyChangedEventHandler eh = PropertyChanged;
|
||||
|
||||
if (eh != null)
|
||||
eh(this, e);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <summary>
|
||||
/// Dispose
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
for (int i = 0; i < _Styles.Length; i++)
|
||||
{
|
||||
T style = _Styles[i];
|
||||
|
||||
if (style != null)
|
||||
{
|
||||
SetStyle(i, null);
|
||||
|
||||
style.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
_Styles = null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user