1403 lines
		
	
	
		
			39 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
			
		
		
	
	
			1403 lines
		
	
	
		
			39 KiB
		
	
	
	
		
			C#
		
	
	
	
	
	
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>
 | 
						|
    /// ContainerVisualStyles
 | 
						|
    ///</summary>
 | 
						|
    [TypeConverter(typeof(VisualStylesConverter))]
 | 
						|
    public class ContainerVisualStyles : VisualStyles<ContainerVisualStyle>
 | 
						|
    {
 | 
						|
        #region Copy
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Returns the copy of the style.
 | 
						|
        /// </summary>
 | 
						|
        /// <returns>Copy of the style.</returns>
 | 
						|
        public ContainerVisualStyles Copy()
 | 
						|
        {
 | 
						|
            ContainerVisualStyles styles = new ContainerVisualStyles();
 | 
						|
 | 
						|
            for (int i = 0; i < Styles.Length; i++)
 | 
						|
            {
 | 
						|
                ContainerVisualStyle vstyle = Styles[i];
 | 
						|
 | 
						|
                if (vstyle != null)
 | 
						|
                    styles.Styles[i] = vstyle.Copy();
 | 
						|
            }
 | 
						|
 | 
						|
            return (styles);
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
    }
 | 
						|
 | 
						|
    /// <summary>
 | 
						|
    /// Represents the visual style of a container item.
 | 
						|
    /// </summary>
 | 
						|
    [ToolboxItem(false), DesignTimeVisible(false)]
 | 
						|
    [TypeConverter(typeof(BlankExpandableObjectConverter))]
 | 
						|
    public class ContainerVisualStyle : VisualStyle
 | 
						|
    {
 | 
						|
        #region Private variables
 | 
						|
 | 
						|
        private Tbool _AllowWrap = Tbool.NotSet;
 | 
						|
        private Alignment _Alignment = Alignment.NotSet;
 | 
						|
 | 
						|
        private Image _Image;
 | 
						|
        private int _ImageIndex = -1;
 | 
						|
        private ImageList _ImageList;
 | 
						|
 | 
						|
        private Padding _ImagePadding;
 | 
						|
 | 
						|
        private Alignment _ImageAlignment = Alignment.NotSet;
 | 
						|
        private ImageOverlay _ImageOverlay = ImageOverlay.NotSet;
 | 
						|
        private ImageSizeMode _ImageSizeMode = ImageSizeMode.NotSet;
 | 
						|
 | 
						|
        private Tbool _EnableImageScroll = Tbool.NotSet;
 | 
						|
 | 
						|
        private DropShadowVisualStyle _DropShadow;
 | 
						|
 | 
						|
        private SymbolDef _SymbolDef;
 | 
						|
 | 
						|
        #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 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 EnableImageScroll
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Gets or sets whether the image scrolls or is fixed with the container content.
 | 
						|
        /// </summary>
 | 
						|
        [DefaultValue(Tbool.NotSet)]
 | 
						|
        [Category("Appearance"), Description("Indicates whether the image scrolls or is fixed with the container content.")]
 | 
						|
        public Tbool EnableImageScroll
 | 
						|
        {
 | 
						|
            get { return (_EnableImageScroll); }
 | 
						|
 | 
						|
            set
 | 
						|
            {
 | 
						|
                if (value != _EnableImageScroll)
 | 
						|
                {
 | 
						|
                    _EnableImageScroll = value;
 | 
						|
 | 
						|
                    OnPropertyChangedEx("EnableImageScroll", VisualChangeType.Render);
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region Image
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Gets or sets the element Image
 | 
						|
        /// </summary>
 | 
						|
        [DefaultValue(null), Category("Appearance")]
 | 
						|
        [Description("Indicates the element image")]
 | 
						|
        public Image Image
 | 
						|
        {
 | 
						|
            get { return (_Image); }
 | 
						|
 | 
						|
            set
 | 
						|
            {
 | 
						|
                if (_Image != value)
 | 
						|
                {
 | 
						|
                    _Image = value;
 | 
						|
 | 
						|
                    OnPropertyChangedEx("Image", VisualChangeType.Layout);
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region ImageAlignment
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Gets or sets the alignment of the Image
 | 
						|
        /// </summary>
 | 
						|
        [DefaultValue(Alignment.NotSet), Category("Appearance")]
 | 
						|
        [Description("Indicates the alignment of the Image.")]
 | 
						|
        public Alignment ImageAlignment
 | 
						|
        {
 | 
						|
            get { return (_ImageAlignment); }
 | 
						|
 | 
						|
            set
 | 
						|
            {
 | 
						|
                if (_ImageAlignment != value)
 | 
						|
                {
 | 
						|
                    _ImageAlignment = value;
 | 
						|
 | 
						|
                    OnPropertyChangedEx("ImageAlignment", VisualChangeType.Layout);
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region ImageIndex
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Gets or sets the 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;
 | 
						|
 | 
						|
                    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;
 | 
						|
 | 
						|
                    OnPropertyChangedEx("ImageList", VisualChangeType.Layout);
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region ImageOverlay
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Gets or sets how to overlay the cell image with respect to cell content
 | 
						|
        /// </summary>
 | 
						|
        [DefaultValue(ImageOverlay.NotSet), Category("Appearance")]
 | 
						|
        [Description("Indicates how to overlay the cell image with respect to cell content.")]
 | 
						|
        public ImageOverlay ImageOverlay
 | 
						|
        {
 | 
						|
            get { return (_ImageOverlay); }
 | 
						|
 | 
						|
            set
 | 
						|
            {
 | 
						|
                if (_ImageOverlay != value)
 | 
						|
                {
 | 
						|
                    _ImageOverlay = value;
 | 
						|
 | 
						|
                    OnPropertyChangedEx("ImageOverlay", VisualChangeType.Layout);
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region ImagePadding
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Gets or sets the spacing between content and edges of the Image
 | 
						|
        /// </summary>
 | 
						|
        [Description("Indicates the spacing between content and edges of the Image")]
 | 
						|
        public Padding ImagePadding
 | 
						|
        {
 | 
						|
            get
 | 
						|
            {
 | 
						|
                if (_ImagePadding == null)
 | 
						|
                {
 | 
						|
                    _ImagePadding = Padding.Empty;
 | 
						|
 | 
						|
                    UpdateChangeHandler(null, _ImagePadding);
 | 
						|
                }
 | 
						|
 | 
						|
                return (_ImagePadding);
 | 
						|
            }
 | 
						|
 | 
						|
            set
 | 
						|
            {
 | 
						|
                if (_ImagePadding != value)
 | 
						|
                {
 | 
						|
                    UpdateChangeHandler(_ImagePadding, value);
 | 
						|
 | 
						|
                    _ImagePadding = value;
 | 
						|
 | 
						|
                    OnPropertyChangedEx("ImagePadding", VisualChangeType.Layout);
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Gets whether property should be serialized.
 | 
						|
        /// </summary>
 | 
						|
        [EditorBrowsable(EditorBrowsableState.Never)]
 | 
						|
        private bool ShouldSerializeImagePadding()
 | 
						|
        {
 | 
						|
            return (_ImagePadding != null && _ImagePadding.IsEmpty == false);
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Resets property to its default value.
 | 
						|
        /// </summary>
 | 
						|
        [EditorBrowsable(EditorBrowsableState.Never)]
 | 
						|
        private void ResetImagePadding()
 | 
						|
        {
 | 
						|
            ImagePadding = null;
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region ImageSizeMode
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Gets or sets the 'mode' used to display the image.
 | 
						|
        /// </summary>
 | 
						|
        [DefaultValue(ImageSizeMode.NotSet), Category("Appearance")]
 | 
						|
        [Description("Indicates the 'mode' used to display the image.")]
 | 
						|
        public ImageSizeMode ImageSizeMode
 | 
						|
        {
 | 
						|
            get { return (_ImageSizeMode); }
 | 
						|
 | 
						|
            set
 | 
						|
            {
 | 
						|
                if (value!= _ImageSizeMode)
 | 
						|
                {
 | 
						|
                    _ImageSizeMode = value;
 | 
						|
 | 
						|
                    OnPropertyChangedEx("ImageSizeMode", VisualChangeType.Render);
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region SymbolDef
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Gets or sets the element Symbol Definition. Note that Symbol definition
 | 
						|
        /// takes precedence over Image definition. Also note that the supporting Image
 | 
						|
        /// properties (such as ImageAlignment, ImageOverlay, etc) apply to a set
 | 
						|
        /// Symbol as well as to a set Image.
 | 
						|
        /// </summary>
 | 
						|
        [DefaultValue(null), Category("Appearance")]
 | 
						|
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
 | 
						|
        [Description("Indicates the element Symbol Definition. Note that Symbol definition takes precedence over Image definition. Also note that the supporting Image properties (such as ImageAlignment, ImageOverlay, etc) apply to a set Symbol as well as to a set Image.")]
 | 
						|
        public SymbolDef SymbolDef
 | 
						|
        {
 | 
						|
            get
 | 
						|
            {
 | 
						|
                if (_SymbolDef == null)
 | 
						|
                {
 | 
						|
                    _SymbolDef = new SymbolDef();
 | 
						|
 | 
						|
                    UpdateChangeHandler(null, _SymbolDef);
 | 
						|
                }
 | 
						|
 | 
						|
                return (_SymbolDef);
 | 
						|
            }
 | 
						|
 | 
						|
            set
 | 
						|
            {
 | 
						|
                if (_SymbolDef != value)
 | 
						|
                {
 | 
						|
                    UpdateChangeHandler(_SymbolDef, value);
 | 
						|
 | 
						|
                    _SymbolDef = value;
 | 
						|
 | 
						|
                    OnPropertyChangedEx("SymbolDef", VisualChangeType.Layout);
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Gets whether property should be serialized.
 | 
						|
        /// </summary>
 | 
						|
        [EditorBrowsable(EditorBrowsableState.Never)]
 | 
						|
        private bool ShouldSerializeSymbolDef()
 | 
						|
        {
 | 
						|
            return (_SymbolDef != null && _SymbolDef.IsEmpty == false);
 | 
						|
        }
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Resets property to its default value.
 | 
						|
        /// </summary>
 | 
						|
        [EditorBrowsable(EditorBrowsableState.Never)]
 | 
						|
        private void ResetSymbolDef()
 | 
						|
        {
 | 
						|
            SymbolDef = 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 ((_Alignment == Alignment.NotSet) &&
 | 
						|
                    (_AllowWrap == Tbool.NotSet) &&
 | 
						|
                    (_DropShadow == null || _DropShadow.IsEmpty) &&
 | 
						|
                    (_Image == null) &&
 | 
						|
                    (_ImageAlignment == Alignment.NotSet) &&
 | 
						|
                    (_ImageIndex == -1) &&
 | 
						|
                    (_ImageList == null) &&
 | 
						|
                    (_ImageOverlay == ImageOverlay.NotSet) &&
 | 
						|
                    (_ImagePadding == null || _ImagePadding.IsEmpty == true) &&
 | 
						|
                    (_ImageSizeMode == Style.ImageSizeMode.NotSet) &&
 | 
						|
                    (_SymbolDef == null || _SymbolDef.IsEmpty == true) &&
 | 
						|
                    (base.IsEmpty == true));
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region Internal properties
 | 
						|
 | 
						|
        #region IsOverlayImage
 | 
						|
 | 
						|
        internal bool IsOverlayImage
 | 
						|
        {
 | 
						|
            get
 | 
						|
            {
 | 
						|
                return (_ImageOverlay == ImageOverlay.Top ||
 | 
						|
                    _ImageOverlay == ImageOverlay.Middle ||
 | 
						|
                    _ImageOverlay == ImageOverlay.Bottom);
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region IsValidFigure
 | 
						|
 | 
						|
        internal bool IsValidFigure
 | 
						|
        {
 | 
						|
            get
 | 
						|
            {
 | 
						|
                if (IsSymbolFigure == true)
 | 
						|
                    return (true);
 | 
						|
 | 
						|
                return (GetImage() != null);
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region IsSymbolFigure
 | 
						|
 | 
						|
        internal bool IsSymbolFigure
 | 
						|
        {
 | 
						|
            get { return (_SymbolDef != null &&  _SymbolDef.IsValidSymbol == true); }
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region GetFigure
 | 
						|
 | 
						|
        internal object GetFigure()
 | 
						|
        {
 | 
						|
            if (_SymbolDef != null && _SymbolDef.IsEmpty == false)
 | 
						|
                return (_SymbolDef);
 | 
						|
 | 
						|
            return (GetImage());
 | 
						|
        }
 | 
						|
 | 
						|
        #region GetImage
 | 
						|
 | 
						|
        internal Image GetImage()
 | 
						|
        {
 | 
						|
            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
 | 
						|
 | 
						|
        #region GetSymbol
 | 
						|
 | 
						|
        internal string GetSymbol()
 | 
						|
        {
 | 
						|
            if (_SymbolDef != null && _SymbolDef.IsEmpty == false)
 | 
						|
                return (_SymbolDef.SymbolRealized);
 | 
						|
 | 
						|
            return (null);
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region GetFigureSize
 | 
						|
 | 
						|
        internal Size GetFigureSize(Graphics g)
 | 
						|
        {
 | 
						|
            Size size = Size.Empty;
 | 
						|
 | 
						|
            if (IsSymbolFigure == true)
 | 
						|
                size = _SymbolDef.GetSymbolSize(g);
 | 
						|
 | 
						|
            else
 | 
						|
            {
 | 
						|
                Image image = GetImage();
 | 
						|
 | 
						|
                if (image != null)
 | 
						|
                    size = Dpi.Size(image.Size);
 | 
						|
            }
 | 
						|
 | 
						|
            if (size.IsEmpty == false)
 | 
						|
            {
 | 
						|
                size.Width += Dpi.Width(ImagePadding.Horizontal);
 | 
						|
                size.Height += Dpi.Height(ImagePadding.Vertical);
 | 
						|
            }
 | 
						|
 | 
						|
            return (size);
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region GetFigureBounds
 | 
						|
 | 
						|
        internal Rectangle GetFigureBounds(Graphics g, Rectangle r)
 | 
						|
        {
 | 
						|
            if (IsSymbolFigure == true)
 | 
						|
                return (GetSymbolBounds(g, r));
 | 
						|
 | 
						|
            return (GetImageBounds(g, r));
 | 
						|
        }
 | 
						|
 | 
						|
        #region GetImageBounds
 | 
						|
 | 
						|
        internal Rectangle GetImageBounds(Graphics g, Rectangle r)
 | 
						|
        {
 | 
						|
            Image image = GetImage();
 | 
						|
 | 
						|
            return (GetImageBounds(g, r, image));
 | 
						|
        }
 | 
						|
 | 
						|
        private Rectangle GetImageBounds(Graphics g, Rectangle r, Image image)
 | 
						|
        {
 | 
						|
            if (image != null)
 | 
						|
                return (GetSizeBounds(r, Dpi.Size(image.Size)));
 | 
						|
 | 
						|
            return (Rectangle.Empty);
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region GetSymbolBounds
 | 
						|
 | 
						|
        internal Rectangle GetSymbolBounds(Graphics g, Rectangle r)
 | 
						|
        {
 | 
						|
            if (_SymbolDef != null && _SymbolDef.IsEmpty == false)
 | 
						|
            {
 | 
						|
                Size size = _SymbolDef.GetSymbolSize(g);
 | 
						|
 | 
						|
                return (GetSizeBounds(r, size));
 | 
						|
            }
 | 
						|
 | 
						|
            return (Rectangle.Empty);
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region GetSizeBounds
 | 
						|
 | 
						|
        internal Rectangle GetSizeBounds(Rectangle r, Size size)
 | 
						|
        {
 | 
						|
            switch (ImageAlignment)
 | 
						|
            {
 | 
						|
                case Alignment.NotSet:
 | 
						|
                case Alignment.MiddleLeft:
 | 
						|
                    r.Y += (r.Height - size.Height) / 2;
 | 
						|
 | 
						|
                    r.X += Dpi.Width(ImagePadding.Left);
 | 
						|
                    r.Y += Dpi.Height(ImagePadding.Top - ImagePadding.Bottom);
 | 
						|
                    break;
 | 
						|
 | 
						|
                case Alignment.TopLeft:
 | 
						|
                    r.X += Dpi.Width(ImagePadding.Left);
 | 
						|
                    r.Y += Dpi.Height(ImagePadding.Top);
 | 
						|
                    break;
 | 
						|
 | 
						|
                case Alignment.BottomLeft:
 | 
						|
                    r.Y = r.Bottom - size.Height;
 | 
						|
 | 
						|
                    r.X += Dpi.Width(ImagePadding.Left);
 | 
						|
                    r.Y -= Dpi.Height(ImagePadding.Bottom);
 | 
						|
                    break;
 | 
						|
 | 
						|
                case Alignment.TopCenter:
 | 
						|
                    r.X += (r.Width - size.Width) / 2;
 | 
						|
 | 
						|
                    r.X += Dpi.Width(ImagePadding.Left - ImagePadding.Right);
 | 
						|
                    r.Y += Dpi.Height(ImagePadding.Top);
 | 
						|
                    break;
 | 
						|
 | 
						|
                case Alignment.MiddleCenter:
 | 
						|
                    r.X += (r.Width - size.Width) / 2;
 | 
						|
                    r.Y += (r.Height - size.Height) / 2;
 | 
						|
 | 
						|
                    r.X += Dpi.Width(ImagePadding.Left - ImagePadding.Right);
 | 
						|
                    r.Y += Dpi.Height(ImagePadding.Top - ImagePadding.Bottom);
 | 
						|
                    break;
 | 
						|
 | 
						|
                case Alignment.BottomCenter:
 | 
						|
                    r.X += (r.Width - size.Width) / 2;
 | 
						|
                    r.Y = r.Bottom - size.Height;
 | 
						|
 | 
						|
                    r.X += Dpi.Width(ImagePadding.Left - ImagePadding.Right);
 | 
						|
                    r.Y -= Dpi.Height(ImagePadding.Bottom);
 | 
						|
                    break;
 | 
						|
 | 
						|
                case Alignment.TopRight:
 | 
						|
                    r.X = r.Right - size.Width;
 | 
						|
 | 
						|
                    r.X -= Dpi.Width(ImagePadding.Right);
 | 
						|
                    r.Y += Dpi.Height(ImagePadding.Top);
 | 
						|
                    break;
 | 
						|
 | 
						|
                case Alignment.MiddleRight:
 | 
						|
                    r.X = r.Right - size.Width;
 | 
						|
                    r.Y += (r.Height - size.Height) / 2;
 | 
						|
 | 
						|
                    r.X -= Dpi.Width(ImagePadding.Right);
 | 
						|
                    r.Y += Dpi.Height(ImagePadding.Top - ImagePadding.Bottom);
 | 
						|
                    break;
 | 
						|
 | 
						|
                case Alignment.BottomRight:
 | 
						|
                    r.X = r.Right - size.Width;
 | 
						|
                    r.Y = r.Bottom - size.Height;
 | 
						|
 | 
						|
                    r.X -= Dpi.Width(ImagePadding.Right);
 | 
						|
                    r.Y -= Dpi.Height(ImagePadding.Bottom);
 | 
						|
                    break;
 | 
						|
            }
 | 
						|
 | 
						|
            r.Size = size;
 | 
						|
 | 
						|
            return (r);
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region RenderBackgroundFigure
 | 
						|
 | 
						|
        internal void RenderBackgroundFigure(Graphics g, Rectangle bounds)
 | 
						|
        {
 | 
						|
            RenderBackgroundFigure(g, bounds, bounds);
 | 
						|
        }
 | 
						|
 | 
						|
        internal void RenderBackgroundFigure(Graphics g, Rectangle bounds, Rectangle clipBounds)
 | 
						|
        {
 | 
						|
            if (IsSymbolFigure == true)
 | 
						|
            {
 | 
						|
                RenderBackgroundSymbol(g, bounds, clipBounds);
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                Image image = GetImage();
 | 
						|
 | 
						|
                if (image != null)
 | 
						|
                    RenderBackgroundImage(g, bounds, clipBounds);
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #region RenderBackgroundImage
 | 
						|
 | 
						|
        internal void RenderBackgroundImage(Graphics g, Rectangle bounds, Rectangle clipBounds)
 | 
						|
        {
 | 
						|
            Image image = GetImage();
 | 
						|
 | 
						|
            if (image != null)
 | 
						|
            {
 | 
						|
                Region clip = g.Clip;
 | 
						|
 | 
						|
                if (ImageSizeMode == ImageSizeMode.NotSet ||
 | 
						|
                    ImageSizeMode == ImageSizeMode.Normal)
 | 
						|
                {
 | 
						|
                    Rectangle dbounds = GetImageBounds(g, clipBounds, image);
 | 
						|
 | 
						|
                    g.SetClip(Rectangle.Intersect(bounds, dbounds));
 | 
						|
 | 
						|
                    g.DrawImage(image, dbounds,
 | 
						|
                        new Rectangle(Point.Empty, image.Size), GraphicsUnit.Pixel);
 | 
						|
                }
 | 
						|
                else
 | 
						|
                {
 | 
						|
                    Rectangle r = GetAdjustedBounds(clipBounds, ImagePadding);
 | 
						|
 | 
						|
                    g.SetClip(r, CombineMode.Intersect);
 | 
						|
 | 
						|
                    switch (ImageSizeMode)
 | 
						|
                    {
 | 
						|
                        case ImageSizeMode.Stretch:
 | 
						|
                            g.DrawImage(image, r);
 | 
						|
                            break;
 | 
						|
 | 
						|
                        case ImageSizeMode.Tile:
 | 
						|
                            RenderImageTiled(g, image, r);
 | 
						|
                            break;
 | 
						|
 | 
						|
                        case ImageSizeMode.Zoom:
 | 
						|
                            RenderImageZoomed(g, image, r);
 | 
						|
                            break;
 | 
						|
                    }
 | 
						|
                }
 | 
						|
 | 
						|
                g.Clip = clip;
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #region GetAdjustedBounds
 | 
						|
 | 
						|
        private Rectangle GetAdjustedBounds(Rectangle bounds, Thickness padding)
 | 
						|
        {
 | 
						|
            if (padding.IsEmpty == false)
 | 
						|
            {
 | 
						|
                if (bounds.Height > padding.Vertical)
 | 
						|
                {
 | 
						|
                    bounds.Y += padding.Top;
 | 
						|
                    bounds.Height -= padding.Vertical;
 | 
						|
                }
 | 
						|
 | 
						|
                if (bounds.Width > padding.Horizontal)
 | 
						|
                {
 | 
						|
                    bounds.X += padding.Left;
 | 
						|
                    bounds.Width -= padding.Horizontal;
 | 
						|
                }
 | 
						|
            }
 | 
						|
 | 
						|
            return (bounds);
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region RenderImageTiled
 | 
						|
 | 
						|
        private void RenderImageTiled(Graphics g, Image image, Rectangle bounds)
 | 
						|
        {
 | 
						|
            Rectangle sr = new Rectangle(Point.Empty, image.Size);
 | 
						|
            Rectangle dr = new Rectangle(bounds.Location, image.Size);
 | 
						|
 | 
						|
            while (dr.Top < bounds.Bottom)
 | 
						|
            {
 | 
						|
                while (dr.Left < bounds.Right)
 | 
						|
                {
 | 
						|
                    g.DrawImage(image, dr, sr, GraphicsUnit.Pixel);
 | 
						|
 | 
						|
                    dr.X += image.Size.Width;
 | 
						|
                }
 | 
						|
 | 
						|
                dr.X = bounds.X;
 | 
						|
                dr.Y += image.Size.Height;
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region RenderImageZoomed
 | 
						|
 | 
						|
        private void RenderImageZoomed(
 | 
						|
            Graphics g, Image image, Rectangle r)
 | 
						|
        {
 | 
						|
            SizeF size = new SizeF(image.Width / image.HorizontalResolution,
 | 
						|
                image.Height / image.VerticalResolution);
 | 
						|
 | 
						|
            float scale = Math.Min(r.Width / size.Width, r.Height / size.Height);
 | 
						|
 | 
						|
            size.Width *= scale;
 | 
						|
            size.Height *= scale;
 | 
						|
 | 
						|
            Point pt = r.Location;
 | 
						|
 | 
						|
            if (Math.Abs(r.Width - size.Width) > 2)
 | 
						|
            {
 | 
						|
                switch (ImageAlignment)
 | 
						|
                {
 | 
						|
                    case Alignment.TopCenter:
 | 
						|
                    case Alignment.MiddleCenter:
 | 
						|
                    case Alignment.BottomCenter:
 | 
						|
                        pt.X += (int)((r.Width - size.Width) / 2);
 | 
						|
                        break;
 | 
						|
 | 
						|
                    case Alignment.TopRight:
 | 
						|
                    case Alignment.MiddleRight:
 | 
						|
                    case Alignment.BottomRight:
 | 
						|
                        pt.X = (int)(r.Right - size.Width);
 | 
						|
                        break;
 | 
						|
                }
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                switch (ImageAlignment)
 | 
						|
                {
 | 
						|
                    case Alignment.MiddleLeft:
 | 
						|
                    case Alignment.MiddleCenter:
 | 
						|
                    case Alignment.MiddleRight:
 | 
						|
                        pt.Y += (int)((r.Height - size.Height) / 2);
 | 
						|
                        break;
 | 
						|
 | 
						|
                    case Alignment.BottomLeft:
 | 
						|
                    case Alignment.BottomCenter:
 | 
						|
                    case Alignment.BottomRight:
 | 
						|
                        pt.Y = (int)(r.Bottom - size.Height);
 | 
						|
                        break;
 | 
						|
                }
 | 
						|
            }
 | 
						|
 | 
						|
            g.DrawImage(image,
 | 
						|
                pt.X, pt.Y, size.Width, size.Height);
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region RenderBackgroundSymbol
 | 
						|
 | 
						|
        internal void RenderBackgroundSymbol(Graphics g, Rectangle bounds, Rectangle clipBounds)
 | 
						|
        {
 | 
						|
            string symbol = GetSymbol();
 | 
						|
 | 
						|
            if (symbol != null)
 | 
						|
            {
 | 
						|
                Region clip = g.Clip;
 | 
						|
 | 
						|
                if (ImageSizeMode != ImageSizeMode.Tile)
 | 
						|
                {
 | 
						|
                    Rectangle dbounds = GetSymbolBounds(g, clipBounds);
 | 
						|
 | 
						|
                    g.SetClip(Rectangle.Intersect(bounds, dbounds));
 | 
						|
 | 
						|
                    using (Brush br = new SolidBrush(_SymbolDef.SymbolColor))
 | 
						|
                        g.DrawString(symbol, _SymbolDef.SymbolFont, br, dbounds);
 | 
						|
                }
 | 
						|
                else
 | 
						|
                {
 | 
						|
                    Rectangle r = GetAdjustedBounds(clipBounds, ImagePadding);
 | 
						|
 | 
						|
                    g.SetClip(r, CombineMode.Intersect);
 | 
						|
 | 
						|
                    RenderSymbolTiled(g, symbol, r);
 | 
						|
                }
 | 
						|
 | 
						|
                g.Clip = clip;
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #region RenderSymbolTiled
 | 
						|
 | 
						|
        private void RenderSymbolTiled(Graphics g, string symbol, Rectangle bounds)
 | 
						|
        {
 | 
						|
            Font font = _SymbolDef.SymbolFont;
 | 
						|
            Color color = _SymbolDef.SymbolColor;
 | 
						|
 | 
						|
            Size size = _SymbolDef.GetSymbolSize(g);
 | 
						|
            Rectangle dr = new Rectangle(bounds.Location, size);
 | 
						|
 | 
						|
            while (dr.Top < bounds.Bottom)
 | 
						|
            {
 | 
						|
                while (dr.Left < bounds.Right)
 | 
						|
                {
 | 
						|
                    TextDrawing.DrawString(g, symbol, font, color, dr, eTextFormat.Default);
 | 
						|
 | 
						|
                    dr.X += size.Width;
 | 
						|
                }
 | 
						|
 | 
						|
                dr.X = bounds.X;
 | 
						|
                dr.Y += size.Height;
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region GetStringFormatFlags
 | 
						|
 | 
						|
        internal void GetStringFormatFlags(StringFormat sf)
 | 
						|
        {
 | 
						|
            if (AllowWrap == Tbool.False)
 | 
						|
                sf.FormatFlags |= StringFormatFlags.NoWrap;
 | 
						|
 | 
						|
            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.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 GetTextFormatFlags
 | 
						|
 | 
						|
        internal eTextFormat GetTextFormatFlags()
 | 
						|
        {
 | 
						|
            eTextFormat tf = eTextFormat.WordEllipsis |
 | 
						|
                eTextFormat.NoPadding | eTextFormat.NoPrefix;
 | 
						|
 | 
						|
            if (AllowWrap == Tbool.True)
 | 
						|
                tf |= eTextFormat.WordBreak;
 | 
						|
 | 
						|
            switch (Alignment)
 | 
						|
            {
 | 
						|
                case Alignment.TopCenter:
 | 
						|
                    tf |= eTextFormat.HorizontalCenter;
 | 
						|
                    break;
 | 
						|
 | 
						|
                case Alignment.TopRight:
 | 
						|
                    tf |= eTextFormat.Right;
 | 
						|
                    break;
 | 
						|
 | 
						|
                case Alignment.MiddleLeft:
 | 
						|
                    tf |= eTextFormat.VerticalCenter;
 | 
						|
                    break;
 | 
						|
 | 
						|
                case Alignment.NotSet:
 | 
						|
                case Alignment.MiddleCenter:
 | 
						|
                    tf |= eTextFormat.HorizontalCenter;
 | 
						|
                    tf |= eTextFormat.VerticalCenter;
 | 
						|
                    break;
 | 
						|
 | 
						|
                case Alignment.MiddleRight:
 | 
						|
                    tf |= eTextFormat.Right;
 | 
						|
                    tf |= eTextFormat.VerticalCenter;
 | 
						|
                    break;
 | 
						|
 | 
						|
                case Alignment.BottomLeft:
 | 
						|
                    tf |= eTextFormat.Bottom;
 | 
						|
                    break;
 | 
						|
 | 
						|
                case Alignment.BottomCenter:
 | 
						|
                    tf |= eTextFormat.Bottom;
 | 
						|
                    tf |= eTextFormat.HorizontalCenter;
 | 
						|
                    break;
 | 
						|
 | 
						|
                case Alignment.BottomRight:
 | 
						|
                    tf |= eTextFormat.Bottom;
 | 
						|
                    tf |= eTextFormat.Right;
 | 
						|
                    break;
 | 
						|
            }
 | 
						|
 | 
						|
            return (tf);
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region ApplyStyle
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Applies the style to instance of this style.
 | 
						|
        /// </summary>
 | 
						|
        /// <param name="style">Style to apply.</param>
 | 
						|
        public void ApplyStyle(ContainerVisualStyle style)
 | 
						|
        {
 | 
						|
            base.ApplyStyle(style);
 | 
						|
 | 
						|
            if (style != null)
 | 
						|
            {
 | 
						|
                if (style.Alignment != Alignment.NotSet)
 | 
						|
                    Alignment = style.Alignment;
 | 
						|
 | 
						|
                if (style.AllowWrap != Tbool.NotSet)
 | 
						|
                    AllowWrap = style.AllowWrap;
 | 
						|
 | 
						|
                if (style._DropShadow != null && style.DropShadow.IsEmpty == false)
 | 
						|
                    DropShadow.ApplyStyle(style.DropShadow);
 | 
						|
 | 
						|
                if (style.EnableImageScroll != Tbool.NotSet)
 | 
						|
                    EnableImageScroll = style.EnableImageScroll;
 | 
						|
 | 
						|
                if (style.ImageIndex >= 0)
 | 
						|
                {
 | 
						|
                    Image = null;
 | 
						|
                    ImageIndex = style.ImageIndex;
 | 
						|
                }
 | 
						|
 | 
						|
                if (style.Image != null)
 | 
						|
                {
 | 
						|
                    Image = style.Image;
 | 
						|
                    ImageIndex = -1;
 | 
						|
                }
 | 
						|
 | 
						|
                if (style.ImageAlignment != Alignment.NotSet)
 | 
						|
                    ImageAlignment = style.ImageAlignment;
 | 
						|
 | 
						|
                if (style.ImageList != null)
 | 
						|
                    ImageList = style.ImageList;
 | 
						|
 | 
						|
                if (style._ImagePadding != null && style._ImagePadding.IsEmpty == false)
 | 
						|
                    ImagePadding = style._ImagePadding.Copy();
 | 
						|
 | 
						|
                if (style.ImageOverlay != ImageOverlay.NotSet)
 | 
						|
                    ImageOverlay = style.ImageOverlay;
 | 
						|
 | 
						|
                if (style.ImageSizeMode != ImageSizeMode.NotSet)
 | 
						|
                    ImageSizeMode = style.ImageSizeMode;
 | 
						|
 | 
						|
                if (style._SymbolDef != null && style._SymbolDef.IsEmpty == false)
 | 
						|
                    SymbolDef = style._SymbolDef.Copy();
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region ApplyDefaults
 | 
						|
 | 
						|
        public override void ApplyDefaults()
 | 
						|
        {
 | 
						|
            base.ApplyDefaults();
 | 
						|
 | 
						|
            if (_SymbolDef != null && _SymbolDef.IsValidSymbol == true)
 | 
						|
            {
 | 
						|
                if (_SymbolDef.SymbolSize == 0)
 | 
						|
                {
 | 
						|
                    if (Font != null)
 | 
						|
                        _SymbolDef.SymbolSize = Font.SizeInPoints;
 | 
						|
                }
 | 
						|
 | 
						|
                if (_SymbolDef.SymbolColor.IsEmpty == true)
 | 
						|
                {
 | 
						|
                    _SymbolDef.SymbolColor = 
 | 
						|
                        (TextColor.IsEmpty == false) ? TextColor : Color.Black;
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region Copy
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Returns the copy of the style.
 | 
						|
        /// </summary>
 | 
						|
        /// <returns>Copy of the style.</returns>
 | 
						|
        public new ContainerVisualStyle Copy()
 | 
						|
        {
 | 
						|
            ContainerVisualStyle style = new ContainerVisualStyle();
 | 
						|
 | 
						|
            CopyTo(style);
 | 
						|
 | 
						|
            return (style);
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region CopyTo
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Returns the copy of the style.
 | 
						|
        /// </summary>
 | 
						|
        /// <returns>Copy of the style.</returns>
 | 
						|
        public void CopyTo(ContainerVisualStyle style)
 | 
						|
        {
 | 
						|
            base.CopyTo(style);
 | 
						|
 | 
						|
            style.Alignment = _Alignment;
 | 
						|
            style.AllowWrap = _AllowWrap;
 | 
						|
            style.DropShadow = (_DropShadow != null) ? DropShadow.Copy() : null;
 | 
						|
            style.EnableImageScroll = _EnableImageScroll;
 | 
						|
 | 
						|
            style.Image = _Image;
 | 
						|
            style.ImageAlignment = _ImageAlignment;
 | 
						|
            style.ImageIndex = _ImageIndex;
 | 
						|
            style.ImageList = _ImageList;
 | 
						|
            style.ImageOverlay = _ImageOverlay;
 | 
						|
            style.ImagePadding = (_ImagePadding != null) ? _ImagePadding.Copy() : null;
 | 
						|
            style.ImageSizeMode = _ImageSizeMode;
 | 
						|
 | 
						|
            style.SymbolDef = (_SymbolDef != null) ? _SymbolDef.Copy() : null;
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region GetSerialData
 | 
						|
 | 
						|
        internal override SerialElementCollection GetSerialData(string serialName)
 | 
						|
        {
 | 
						|
            SerialElementCollection sec = new SerialElementCollection();
 | 
						|
 | 
						|
            if (serialName != null)
 | 
						|
            {
 | 
						|
                if (serialName.Equals("") == true)
 | 
						|
                    serialName = "ContainerVisualStyle";
 | 
						|
 | 
						|
                sec.AddStartElement(serialName);
 | 
						|
            }
 | 
						|
 | 
						|
            sec.AddValue("Alignment", Alignment, Alignment.NotSet);
 | 
						|
            sec.AddValue("AllowWrap", AllowWrap, Tbool.NotSet);
 | 
						|
 | 
						|
            if (_DropShadow != null && _DropShadow.IsEmpty == false)
 | 
						|
                sec.AddElement(_DropShadow.GetSerialData("DropShadow"));
 | 
						|
 | 
						|
            sec.AddValue("EnableImageScroll", EnableImageScroll, Tbool.NotSet);
 | 
						|
            sec.AddValue("Image", Image);
 | 
						|
            sec.AddValue("ImageAlignment", ImageAlignment, Alignment.NotSet);
 | 
						|
            sec.AddValue("ImageIndex", ImageIndex, -1);
 | 
						|
 | 
						|
            if (_ImageList != null)
 | 
						|
                sec.AddValue("ImageList", XmlSerializableImageList.ConvertToString(ImageList));
 | 
						|
 | 
						|
            sec.AddValue("ImageOverlay", ImageOverlay, ImageOverlay.NotSet);
 | 
						|
 | 
						|
            if (_ImagePadding != null && _ImagePadding.IsEmpty == false)
 | 
						|
                sec.AddElement(_ImagePadding.GetSerialData("ImagePadding"));
 | 
						|
 | 
						|
            sec.AddValue("ImageSizeMode", ImageSizeMode, ImageSizeMode.NotSet);
 | 
						|
 | 
						|
            if (_SymbolDef != null && _SymbolDef.IsEmpty == false)
 | 
						|
                sec.AddElement(_SymbolDef.GetSerialData("SymbolDef"));
 | 
						|
 | 
						|
            sec.AddElement(base.GetSerialData(null));
 | 
						|
 | 
						|
            if (serialName != null)
 | 
						|
                sec.AddEndElement("ContainerVisualStyle");
 | 
						|
 | 
						|
            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 "EnableImageScroll":
 | 
						|
                    EnableImageScroll = (Tbool)se.GetValueEnum(typeof(Tbool));
 | 
						|
                    break;
 | 
						|
 | 
						|
                case "Image":
 | 
						|
                    Image = se.GetValueImage();
 | 
						|
                    break;
 | 
						|
 | 
						|
                case "ImageAlignment":
 | 
						|
                    ImageAlignment = (Alignment)se.GetValueEnum(typeof(Alignment));
 | 
						|
                    break;
 | 
						|
 | 
						|
                case "ImageIndex":
 | 
						|
                    ImageIndex = int.Parse(se.StringValue);
 | 
						|
                    break;
 | 
						|
 | 
						|
                case "ImageList":
 | 
						|
                    ImageList = XmlSerializableImageList.ConvertFromString(se.StringValue);
 | 
						|
                    break;
 | 
						|
 | 
						|
                case "ImageOverlay":
 | 
						|
                    ImageOverlay = (ImageOverlay)se.GetValueEnum(typeof(ImageOverlay));
 | 
						|
                    break;
 | 
						|
 | 
						|
                case "ImageSizeMode":
 | 
						|
                    ImageSizeMode = (ImageSizeMode)se.GetValueEnum(typeof(ImageSizeMode));
 | 
						|
                    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;
 | 
						|
 | 
						|
                case "ImagePadding":
 | 
						|
                    sec.PutSerialData(ImagePadding);
 | 
						|
                    break;
 | 
						|
 | 
						|
                case "SymbolDef":
 | 
						|
                    sec.PutSerialData(SymbolDef);
 | 
						|
                    break;
 | 
						|
 | 
						|
                default:
 | 
						|
                    base.ProcessCollection(se);
 | 
						|
                    break;
 | 
						|
            }
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #endregion
 | 
						|
 | 
						|
        #region IDisposable
 | 
						|
 | 
						|
        /// <summary>
 | 
						|
        /// Dispose
 | 
						|
        /// </summary>
 | 
						|
        public override void Dispose()
 | 
						|
        {
 | 
						|
            DropShadow = null;
 | 
						|
            ImagePadding = null;
 | 
						|
            SymbolDef = null;
 | 
						|
 | 
						|
            base.Dispose();
 | 
						|
        }
 | 
						|
 | 
						|
        #endregion
 | 
						|
    }
 | 
						|
 | 
						|
    #region ImageOverlay
 | 
						|
 | 
						|
    ///<summary>
 | 
						|
    /// How to Overlay the Image with
 | 
						|
    /// respect to the content
 | 
						|
    ///</summary>
 | 
						|
    public enum ImageOverlay
 | 
						|
    {
 | 
						|
        ///<summary>
 | 
						|
        /// Not set
 | 
						|
        ///</summary>
 | 
						|
        NotSet = -1,
 | 
						|
 | 
						|
        ///<summary>
 | 
						|
        /// None - Overlaying of the image will be avioded (when possible)
 | 
						|
        ///</summary>
 | 
						|
        None,
 | 
						|
 | 
						|
        ///<summary>
 | 
						|
        /// Top
 | 
						|
        ///</summary>
 | 
						|
        Top,
 | 
						|
 | 
						|
        ///<summary>
 | 
						|
        /// Middle
 | 
						|
        ///</summary>
 | 
						|
        Middle,
 | 
						|
 | 
						|
        ///<summary>
 | 
						|
        /// Bottom
 | 
						|
        ///</summary>
 | 
						|
        Bottom,
 | 
						|
    }
 | 
						|
 | 
						|
    #endregion
 | 
						|
 | 
						|
    #region ImageSizeMode
 | 
						|
 | 
						|
    ///<summary>
 | 
						|
    /// ImageSizeMode
 | 
						|
    ///</summary>
 | 
						|
    public enum ImageSizeMode
 | 
						|
    {
 | 
						|
        ///<summary>
 | 
						|
        /// Not set
 | 
						|
        ///</summary>
 | 
						|
        NotSet = -1,
 | 
						|
 | 
						|
        ///<summary>
 | 
						|
        /// The image is placed according to the specified 
 | 
						|
        /// Alignment, and is clipped if needed to fit.
 | 
						|
        ///</summary>
 | 
						|
        Normal,
 | 
						|
 | 
						|
        ///<summary>
 | 
						|
        /// The image is stretched or shrunk to fit.
 | 
						|
        ///</summary>
 | 
						|
        Stretch,
 | 
						|
 | 
						|
        ///<summary>
 | 
						|
        /// The image is tiled to fill the area.
 | 
						|
        ///</summary>
 | 
						|
        Tile,
 | 
						|
 | 
						|
        ///<summary>
 | 
						|
        /// The size of the image is increased or decreased to fit the
 | 
						|
        /// area, maintaining the image size ratio.
 | 
						|
        ///</summary>
 | 
						|
        Zoom,
 | 
						|
    }
 | 
						|
 | 
						|
    #endregion
 | 
						|
}
 |