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