/// <summary>
        /// Initialize a new instance of the PaletteDataGridViewContentStates class.
        /// </summary>
        /// <param name="inherit">Source for inheriting defaulted values.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public PaletteDataGridViewContentStates(IPaletteContent inherit,
                                                NeedPaintHandler needPaint)
        {
            Debug.Assert(inherit != null);

            // Remember inheritance
            _inherit = inherit;

            // Store the provided paint notification delegate
            NeedPaint = needPaint;

            // Default the initial values
            _draw = InheritBool.Inherit;
            _hint = PaletteTextHint.Inherit;
            _trim = PaletteTextTrim.Inherit;
            _color1 = Color.Empty;
            _color2 = Color.Empty;
            _colorStyle = PaletteColorStyle.Inherit;
            _colorAlign = PaletteRectangleAlign.Inherit;
            _colorAngle = -1;
            _imageStyle = PaletteImageStyle.Inherit;
            _imageAlign = PaletteRectangleAlign.Inherit;
            _multiLine = InheritBool.Inherit;
            _multiLineH = PaletteRelativeAlign.Inherit;
        }
예제 #2
0
        /// <summary>
        /// Initialize a new instance of the PaletteDataGridViewContentStates class.
        /// </summary>
        /// <param name="inherit">Source for inheriting defaulted values.</param>
        /// <param name="needPaint">Delegate for notifying paint requests.</param>
        public PaletteDataGridViewContentStates(IPaletteContent inherit,
                                                NeedPaintHandler needPaint)
        {
            Debug.Assert(inherit != null);

            // Remember inheritance
            _inherit = inherit;

            // Store the provided paint notification delegate
            NeedPaint = needPaint;

            // Default the initial values
            _draw       = InheritBool.Inherit;
            _hint       = PaletteTextHint.Inherit;
            _trim       = PaletteTextTrim.Inherit;
            _color1     = Color.Empty;
            _color2     = Color.Empty;
            _colorStyle = PaletteColorStyle.Inherit;
            _colorAlign = PaletteRectangleAlign.Inherit;
            _colorAngle = -1;
            _imageStyle = PaletteImageStyle.Inherit;
            _imageAlign = PaletteRectangleAlign.Inherit;
            _multiLine  = InheritBool.Inherit;
            _multiLineH = PaletteRelativeAlign.Inherit;
        }
예제 #3
0
 /// <summary>
 /// Initialize a new instance of the InternalStorage structure.
 /// </summary>
 public InternalStorage()
 {
     // Set to default values
     BackDraw         = InheritBool.Inherit;
     BackGraphicsHint = PaletteGraphicsHint.Inherit;
     BackColor1       = Color.Empty;
     BackColor2       = Color.Empty;
     BackColorStyle   = PaletteColorStyle.Inherit;
     BackColorAlign   = PaletteRectangleAlign.Inherit;
     BackColorAngle   = -1;
     BackImageStyle   = PaletteImageStyle.Inherit;
     BackImageAlign   = PaletteRectangleAlign.Inherit;
 }
예제 #4
0
 /// <summary>
 /// Initialize a new instance of the InternalStorage structure.
 /// </summary>
 public InternalStorage()
 {
     // Set to default values
     BorderDraw         = InheritBool.Inherit;
     BorderDrawBorders  = PaletteDrawBorders.All;
     BorderGraphicsHint = PaletteGraphicsHint.Inherit;
     BorderColor1       = Color.Empty;
     BorderColor2       = Color.Empty;
     BorderColorStyle   = PaletteColorStyle.Inherit;
     BorderColorAlign   = PaletteRectangleAlign.Inherit;
     BorderColorAngle   = -1;
     BorderWidth        = -1;
     BorderRounding     = -1;
     BorderImageStyle   = PaletteImageStyle.Inherit;
     BorderImageAlign   = PaletteRectangleAlign.Inherit;
 }
 /// <summary>
 /// Initialize a new instance of the InternalStorage structure.
 /// </summary>
 public InternalStorage()
 {
     // Set to default values
     ContentTextHint       = PaletteTextHint.Inherit;
     ContentTextTrim       = PaletteTextTrim.Inherit;
     ContentTextPrefix     = PaletteTextHotkeyPrefix.Inherit;
     ContentTextH          = PaletteRelativeAlign.Inherit;
     ContentTextV          = PaletteRelativeAlign.Inherit;
     ContentTextMultiLineH = PaletteRelativeAlign.Inherit;
     ContentTextMultiLine  = InheritBool.Inherit;
     ContentTextColor1     = Color.Empty;
     ContentTextColor2     = Color.Empty;
     ContentTextColorStyle = PaletteColorStyle.Inherit;
     ContentTextColorAlign = PaletteRectangleAlign.Inherit;
     ContentTextColorAngle = -1;
     ContentTextImageStyle = PaletteImageStyle.Inherit;
     ContentTextImageAlign = PaletteRectangleAlign.Inherit;
 }
        /// <summary>
        /// Gets the background image style.
        /// </summary>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Image style value.</returns>
        public override PaletteImageStyle GetBackImageStyle(PaletteState state)
        {
            if (Apply)
            {
                PaletteImageStyle ret = _primary.GetBackImageStyle(Override ? OverrideState : state);

                if (ret == PaletteImageStyle.Inherit)
                {
                    ret = _backup.GetBackImageStyle(state);
                }

                return(ret);
            }
            else
            {
                return(_backup.GetBackImageStyle(state));
            }
        }
예제 #7
0
        /// <summary>
        /// Gets the background image style.
        /// </summary>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Image style value.</returns>
        public virtual PaletteImageStyle GetContentShortTextImageStyle(PaletteState state)
        {
            if (Apply)
            {
                PaletteImageStyle ret = _primaryContent.GetContentShortTextImageStyle(Override ? OverrideState : state);

                if (ret == PaletteImageStyle.Inherit)
                {
                    ret = _backupContent.GetContentShortTextImageStyle(state);
                }

                return(ret);
            }
            else
            {
                return(_backupContent.GetContentShortTextImageStyle(state));
            }
        }
예제 #8
0
        /// <summary>
        /// Gets the background image style.
        /// </summary>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Image style value.</returns>
        public override PaletteImageStyle GetContentShortTextImageStyle(PaletteState state)
        {
            if (_apply)
            {
                PaletteImageStyle ret = _primary.GetContentShortTextImageStyle(_override ? _state : state);

                if (ret == PaletteImageStyle.Inherit)
                {
                    ret = _backup.GetContentShortTextImageStyle(state);
                }

                return(ret);
            }
            else
            {
                return(_backup.GetContentShortTextImageStyle(state));
            }
        }
예제 #9
0
        private static Brush CreateImageBrush(Rectangle rect,
                                              Image image,
                                              PaletteImageStyle imageStyle)
        {
            // Create brush based on the provided image
            TextureBrush brush = new TextureBrush(image);

            // Create appropriate wrapping mode from image style
            switch (imageStyle)
            {
                case PaletteImageStyle.TopLeft:
                    brush.WrapMode = WrapMode.Clamp;
                    brush.TranslateTransform(rect.Left, rect.Top);
                    break;
                case PaletteImageStyle.TopMiddle:
                    brush.WrapMode = WrapMode.Clamp;
                    brush.TranslateTransform(rect.Left + (rect.Width - image.Width) / 2, rect.Top);
                    break;
                case PaletteImageStyle.TopRight:
                    brush.WrapMode = WrapMode.Clamp;
                    brush.TranslateTransform(rect.Right - image.Width, rect.Top);
                    break;
                case PaletteImageStyle.CenterLeft:
                    brush.WrapMode = WrapMode.Clamp;
                    brush.TranslateTransform(rect.Left, rect.Top + (rect.Height - image.Height) / 2);
                    break;
                case PaletteImageStyle.CenterMiddle:
                    brush.WrapMode = WrapMode.Clamp;
                    brush.TranslateTransform(rect.Left + (rect.Width - image.Width) / 2, rect.Top + (rect.Height - image.Height) / 2);
                    break;
                case PaletteImageStyle.CenterRight:
                    brush.WrapMode = WrapMode.Clamp;
                    brush.TranslateTransform(rect.Right - image.Width, rect.Top + (rect.Height - image.Height) / 2);
                    break;
                case PaletteImageStyle.BottomLeft:
                    brush.WrapMode = WrapMode.Clamp;
                    brush.TranslateTransform(rect.Left, rect.Bottom - image.Height);
                    break;
                case PaletteImageStyle.BottomMiddle:
                    brush.WrapMode = WrapMode.Clamp;
                    brush.TranslateTransform(rect.Left + (rect.Width - image.Width) / 2, rect.Bottom - image.Height);
                    break;
                case PaletteImageStyle.BottomRight:
                    brush.WrapMode = WrapMode.Clamp;
                    brush.TranslateTransform(rect.Right - image.Width, rect.Bottom - image.Height);
                    break;
                case PaletteImageStyle.Stretch:
                    brush.WrapMode = WrapMode.Clamp;
                    brush.TranslateTransform(rect.Left, rect.Top);
                    brush.ScaleTransform((float)rect.Width / (float)image.Width, (float)rect.Height / (float)image.Height);
                    break;
                case PaletteImageStyle.Tile:
                    brush.WrapMode = WrapMode.Tile;
                    brush.TranslateTransform(rect.Left, rect.Top);
                    break;
                case PaletteImageStyle.TileFlipX:
                    brush.WrapMode = WrapMode.TileFlipX;
                    brush.TranslateTransform(rect.Left, rect.Top);
                    break;
                case PaletteImageStyle.TileFlipY:
                    brush.WrapMode = WrapMode.TileFlipY;
                    brush.TranslateTransform(rect.Left, rect.Top);
                    break;
                case PaletteImageStyle.TileFlipXY:
                    brush.WrapMode = WrapMode.TileFlipXY;
                    brush.TranslateTransform(rect.Left, rect.Top);
                    break;
                default:
                    // Should never happen!
                    Debug.Assert(false);
                    throw new ArgumentOutOfRangeException("imageStyle");
            }

            return brush;
        }
예제 #10
0
 /// <summary>
 /// Initialize a new instance of the InternalStorage structure.
 /// </summary>
 public InternalStorage()
 {
     // Set to default values
     ContentTextHint = PaletteTextHint.Inherit;
     ContentTextTrim = PaletteTextTrim.Inherit;
     ContentTextPrefix = PaletteTextHotkeyPrefix.Inherit;
     ContentTextH = PaletteRelativeAlign.Inherit;
     ContentTextV = PaletteRelativeAlign.Inherit;
     ContentTextMultiLineH = PaletteRelativeAlign.Inherit;
     ContentTextMultiLine = InheritBool.Inherit;
     ContentTextColor1 = Color.Empty;
     ContentTextColor2 = Color.Empty;
     ContentTextColorStyle = PaletteColorStyle.Inherit;
     ContentTextColorAlign = PaletteRectangleAlign.Inherit;
     ContentTextColorAngle = -1;
     ContentTextImageStyle = PaletteImageStyle.Inherit;
     ContentTextImageAlign = PaletteRectangleAlign.Inherit;
 }
예제 #11
0
 /// <summary>
 /// Initialize a new instance of the InternalStorage structure.
 /// </summary>
 public InternalStorage()
 {
     // Set to default values
     BorderDraw = InheritBool.Inherit;
     BorderDrawBorders = PaletteDrawBorders.All;
     BorderGraphicsHint = PaletteGraphicsHint.Inherit;
     BorderColor1 = Color.Empty;
     BorderColor2 = Color.Empty;
     BorderColorStyle = PaletteColorStyle.Inherit;
     BorderColorAlign = PaletteRectangleAlign.Inherit;
     BorderColorAngle = -1;
     BorderWidth = -1;
     BorderRounding = -1;
     BorderImageStyle = PaletteImageStyle.Inherit;
     BorderImageAlign = PaletteRectangleAlign.Inherit;
 }
예제 #12
0
 /// <summary>
 /// Initialize a new instance of the InternalStorage structure.
 /// </summary>
 public InternalStorage()
 {
     // Set to default values
     BackDraw = InheritBool.Inherit;
     BackGraphicsHint = PaletteGraphicsHint.Inherit;
     BackColor1 = Color.Empty;
     BackColor2 = Color.Empty;
     BackColorStyle = PaletteColorStyle.Inherit;
     BackColorAlign = PaletteRectangleAlign.Inherit;
     BackColorAngle = -1;
     BackImageStyle = PaletteImageStyle.Inherit;
     BackImageAlign = PaletteRectangleAlign.Inherit;
 }