207 lines
		
	
	
		
			5.6 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			207 lines
		
	
	
		
			5.6 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
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
 | 
						|
    }
 | 
						|
}
 |