DotNet 4.8.1 build of DotNetBar
This commit is contained in:
@@ -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
|
||||
|
||||
}
|
Reference in New Issue
Block a user