Пример #1
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;
        }
        /// <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;
 }
Пример #6
0
        /// <summary>
        /// Gets the color drawing style for the short text.
        /// </summary>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Color drawing style.</returns>
        public virtual PaletteColorStyle GetContentShortTextColorStyle(PaletteState state)
        {
            if (Apply)
            {
                PaletteColorStyle ret = _primaryContent.GetContentShortTextColorStyle(Override ? OverrideState : state);

                if (ret == PaletteColorStyle.Inherit)
                {
                    ret = _backupContent.GetContentShortTextColorStyle(state);
                }

                return(ret);
            }
            else
            {
                return(_backupContent.GetContentShortTextColorStyle(state));
            }
        }
        /// <summary>
        /// Gets the color drawing style.
        /// </summary>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Color drawing style.</returns>
        public override PaletteColorStyle GetBackColorStyle(PaletteState state)
        {
            if (Apply)
            {
                PaletteColorStyle ret = _primary.GetBackColorStyle(Override ? OverrideState : state);

                if (ret == PaletteColorStyle.Inherit)
                {
                    ret = _backup.GetBackColorStyle(state);
                }

                return(ret);
            }
            else
            {
                return(_backup.GetBackColorStyle(state));
            }
        }
Пример #8
0
        /// <summary>
        /// Gets the color drawing style for the long text.
        /// </summary>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Color drawing style.</returns>
        public override PaletteColorStyle GetContentLongTextColorStyle(PaletteState state)
        {
            if (_apply)
            {
                PaletteColorStyle ret = _primary.GetContentLongTextColorStyle(_override ? _state : state);

                if (ret == PaletteColorStyle.Inherit)
                {
                    ret = _backup.GetContentLongTextColorStyle(state);
                }

                return(ret);
            }
            else
            {
                return(_backup.GetContentLongTextColorStyle(state));
            }
        }
Пример #9
0
        private void DrawBackRoundedTopLight(RenderContext context,
                                             Rectangle rect,
                                             Rectangle gradientRect,
                                             Color backColor1,
                                             Color backColor2,
                                             PaletteColorStyle backColorStyle,
                                             float backColorAngle,
                                             VisualOrientation orientation,
                                             GraphicsPath path)
        {
            using (Clipping clip = new Clipping(context.Graphics, path))
            {
                // Draw entire background in white
                using(SolidBrush lightBrush = new SolidBrush(ControlPaint.LightLight(backColor1)))
                    context.Graphics.FillRectangle(lightBrush, rect);

                // Offset the drawing rectangle depending on the orientation
                switch (orientation)
                {
                    case VisualOrientation.Top:
                        rect.Y++;
                        rect.Height--;
                        break;
                    case VisualOrientation.Bottom:
                        rect.Height--;
                        break;
                    case VisualOrientation.Left:
                        rect.X++;
                        rect.Width--;
                        break;
                    case VisualOrientation.Right:
                        rect.Width--;
                        break;
                }

                // Draw the second color as the offset background
                using (Brush backBrush = CreateColorBrush(gradientRect,
                                                          backColor1,
                                                          backColor2,
                                                          PaletteColorStyle.Rounded,
                                                          backColorAngle,
                                                          orientation))
                {
                    context.Graphics.FillRectangle(backBrush, rect);
                }
            }
        }
Пример #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
        public static Brush GetBrush(Rectangle rect, Color ColorBegin, Color ColorEnd, PaletteColorStyle ColorStyle, float Angle, VisualOrientation orientation, bool PreserveColors)
        {
            Blend blend1 = new Blend(4);
            Blend blend2;
            Blend blend3;
            Blend blend4;
            Blend blend5;
            Blend blend6;
            Blend blend7;
            Blend blend8;
            Blend blend9;
            Blend blend10;
            Blend blend11;
            Blend blend12;

            // One time creation of the blend for the status strip gradient brush
            Blend blend13 = new Blend();

            blend13.Positions = new float[] { 0.0f, 0.25f, 0.25f, 0.57f, 0.86f, 1.0f };
            blend13.Factors   = new float[] { 0.1f, 0.6f, 1.0f, 0.4f, 0.0f, 0.95f };

            //Default
            blend1.Positions[0] = 0f;
            blend1.Factors[0]   = 1f;
            blend1.Positions[1] = 0.4f;
            blend1.Factors[1]   = 0.5f;
            blend1.Positions[2] = 0.4f;
            blend1.Factors[2]   = 0.1f; //0 darker 0.3 lighter (middle line)
            blend1.Positions[3] = 1f;
            blend1.Factors[3]   = 0.9f;

            float[] numArray = new float[4];
            numArray[2] = 1f;
            numArray[3] = 1f;
            blend2      = new Blend();
            float[] numArray2 = new float[4];
            numArray2[2]     = 1f;
            numArray2[3]     = 1f;
            blend2.Factors   = numArray2;
            blend2.Positions = new float[] { 0f, 0.33f, 0.33f, 1f };
            blend3           = new Blend();
            float[] numArray3 = new float[4];
            numArray3[2]     = 1f;
            numArray3[3]     = 1f;
            blend3.Factors   = numArray3;
            blend3.Positions = new float[] { 0f, 0.5f, 0.5f, 1f };
            blend4           = new Blend();
            float[] numArray4 = new float[4];
            numArray4[3]      = 1f;
            blend4.Factors    = numArray4;
            blend4.Positions  = new float[] { 0f, 0.9f, 0.9f, 1f };
            blend5            = new Blend();
            blend5.Factors    = new float[] { 0f, 0.5f, 1f, 0.05f };
            blend5.Positions  = new float[] { 0f, 0.45f, 0.45f, 1f };
            blend6            = new Blend();
            blend6.Factors    = new float[] { 0f, 0f, 0.25f, 0.7f, 1f, 1f };
            blend6.Positions  = new float[] { 0f, 0.1f, 0.2f, 0.3f, 0.5f, 1f };
            blend7            = new Blend();
            blend7.Factors    = new float[] { 0.15f, 0.75f, 1f, 1f };
            blend7.Positions  = new float[] { 0f, 0.45f, 0.45f, 1f };
            blend8            = new Blend();
            blend8.Factors    = new float[] { 0.8f, 0.2f, 0f, 0.07f, 1f };
            blend8.Positions  = new float[] { 0f, 0.33f, 0.33f, 0.43f, 1f };
            blend9            = new Blend();
            blend9.Factors    = new float[] { 1f, 0.7f, 0.7f, 0f, 0.1f, 0.55f, 1f, 1f };
            blend9.Positions  = new float[] { 0f, 0.16f, 0.33f, 0.35f, 0.51f, 0.85f, 0.85f, 1f };
            blend10           = new Blend();
            blend10.Factors   = new float[] { 1f, 0.78f, 0.48f, 1f, 1f };
            blend10.Positions = new float[] { 0f, 0.33f, 0.33f, 0.9f, 1f };
            blend11           = new Blend();
            blend12           = new Blend();
            blend12.Factors   = numArray;
            blend12.Positions = new float[] { 0f, 0.25f, 0.25f, 1f };


            //For Gefault Type Only
            if (ColorStyle == PaletteColorStyle.Default)
            {
                LinearGradientBrush lb;
                if (PreserveColors)
                {
                    lb = new LinearGradientBrush(rect, ColorEnd, ColorBegin, Angle);
                }
                else
                {
                    lb = new LinearGradientBrush(rect, GetDarkColor(ColorEnd), GetLightColor(ColorBegin), Angle);
                }

                lb.Blend = blend1;
                return(lb);
            }


            //Solid
            if (ColorStyle == PaletteColorStyle.Solid)
            {
                return(new SolidBrush(ColorBegin));
            }

            switch (orientation)
            {
            case VisualOrientation.Bottom:
                Angle += 180f;
                break;

            case VisualOrientation.Left:
                Angle -= 90f;
                break;

            case VisualOrientation.Right:
                Angle += 90f;
                break;
            }

            //One Note Specific
            if (ColorStyle == PaletteColorStyle.OneNote)
            {
                ColorBegin = Color.White;
            }

            //Others
            LinearGradientBrush brush = new LinearGradientBrush(rect, ColorBegin, ColorEnd, Angle);

            switch (ColorStyle)
            {
            case PaletteColorStyle.Status:
                brush.Blend = blend13;
                return(brush);

            case PaletteColorStyle.Switch25:
                brush.Blend = blend12;
                return(brush);

            case PaletteColorStyle.Switch33:
                brush.Blend = blend2;
                return(brush);

            case PaletteColorStyle.Switch50:
                brush.Blend = blend3;
                return(brush);

            case PaletteColorStyle.Switch90:
                brush.Blend = blend4;
                return(brush);

            case PaletteColorStyle.Linear:
                return(brush);

            case PaletteColorStyle.Rounded:
                brush.SetSigmaBellShape(1f, 1f);
                return(brush);

            case PaletteColorStyle.Rounding2:
                brush.Blend = blend8;
                return(brush);

            case PaletteColorStyle.Rounding3:
                brush.Blend = blend9;
                return(brush);

            case PaletteColorStyle.Rounding4:
                brush.Blend = blend10;
                return(brush);

            case PaletteColorStyle.Sigma:
                brush.SetSigmaBellShape(0.5f);
                return(brush);

            case PaletteColorStyle.HalfCut:
                brush.Blend = blend5;
                return(brush);

            case PaletteColorStyle.QuarterPhase:
                brush.Blend = blend6;
                return(brush);

            case PaletteColorStyle.OneNote:
                brush.Blend = blend7;
                return(brush);
            }
            return(brush);
        }
Пример #12
0
        private static Brush CreateColorBrush(Rectangle rect,
                                              Color color1,
                                              Color color2,
                                              PaletteColorStyle gradientStyle,
                                              float angle,
                                              VisualOrientation orientation)
        {
            // Should never provide the inherit value
            Debug.Assert(gradientStyle != PaletteColorStyle.Inherit);

            // If the gradient style is a solid colour
            if (gradientStyle == PaletteColorStyle.Solid)
                return new SolidBrush(color1);
            else
            {
                // Adjust angle for the orientation
                switch(orientation)
                {
                    case VisualOrientation.Left:
                        angle -= 90;
                        break;
                    case VisualOrientation.Right:
                        angle += 90;
                        break;
                    case VisualOrientation.Bottom:
                        angle += 180;
                        break;
                }

                // For OneNote we always use white as the first color
                if (gradientStyle == PaletteColorStyle.OneNote)
                    color1 = Color.White;

                // Otherwise we always create a linear brush using provided colors and angle
                LinearGradientBrush brush = new LinearGradientBrush(rect, color1, color2, angle);

                switch (gradientStyle)
                {
                    case PaletteColorStyle.Sigma:
                        brush.SetSigmaBellShape(0.5f);
                        break;
                    case PaletteColorStyle.Rounded:
                        brush.SetSigmaBellShape(1f, 1f);
                        break;
                    case PaletteColorStyle.Switch25:
                        brush.Blend = _switch25Blend;
                        break;
                    case PaletteColorStyle.Switch33:
                        brush.Blend = _switch33Blend;
                        break;
                    case PaletteColorStyle.Switch50:
                        brush.Blend = _switch50Blend;
                        break;
                    case PaletteColorStyle.Switch90:
                        brush.Blend = _switch90Blend;
                        break;
                    case PaletteColorStyle.Linear25:
                        brush.Blend = _linear25Blend;
                        break;
                    case PaletteColorStyle.Linear33:
                        brush.Blend = _linear33Blend;
                        break;
                    case PaletteColorStyle.Linear40:
                        brush.Blend = _linear40Blend;
                        break;
                    case PaletteColorStyle.Linear50:
                        brush.Blend = _linear50Blend;
                        break;
                    case PaletteColorStyle.HalfCut:
                        brush.Blend = _halfCutBlend;
                        break;
                    case PaletteColorStyle.QuarterPhase:
                        brush.Blend = _quarterPhaseBlend;
                        break;
                    case PaletteColorStyle.OneNote:
                        brush.Blend = _oneNoteBlend;
                        break;
                    case PaletteColorStyle.Rounding2:
                        brush.Blend = _rounding2Blend;
                        break;
                    case PaletteColorStyle.Rounding3:
                        brush.Blend = _rounding3Blend;
                        break;
                    case PaletteColorStyle.Rounding4:
                        brush.Blend = _rounding4Blend;
                        break;
                    case PaletteColorStyle.Rounding5:
                        brush.Blend = _rounding5Blend;
                        break;
                }

                return brush;
            }
        }
Пример #13
0
        private void DrawBackSolidLine(RenderContext context,
                                       Rectangle rect,
                                       Color backColor1,
                                       Color backColor2,
                                       PaletteColorStyle style,
                                       GraphicsPath path)
        {
            using (Clipping clip = new Clipping(context.Graphics, path))
            {
                // Draw entire background in second color
                using (SolidBrush brushColor2 = new SolidBrush(backColor2))
                    context.Graphics.FillRectangle(brushColor2, rect);

                // Reduce area by edge(s) we want to leave alone
                switch (style)
                {
                    case PaletteColorStyle.SolidTopLine:
                        rect.Y++;
                        rect.Height--;
                        break;
                    case PaletteColorStyle.SolidBottomLine:
                        rect.Height--;
                        break;
                    case PaletteColorStyle.SolidLeftLine:
                        rect.X++;
                        rect.Width--;
                        break;
                    case PaletteColorStyle.SolidRightLine:
                        rect.Width--;
                        break;
                    case PaletteColorStyle.SolidAllLine:
                        rect.X++;
                        rect.Y++;
                        rect.Width -= 2;
                        rect.Height -= 2;
                        break;
                }

                // Draw the second color as a solid block
                using (SolidBrush brushColor2 = new SolidBrush(backColor1))
                    context.Graphics.FillRectangle(brushColor2, rect);
            }
        }
Пример #14
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;
 }
Пример #15
0
        private void DrawBackRoundedTopLeftWhite(RenderContext context,
                                                 Rectangle rect,
                                                 Rectangle gradientRect,
                                                 Color backColor1,
                                                 Color backColor2,
                                                 PaletteColorStyle backColorStyle,
                                                 float backColorAngle,
                                                 VisualOrientation orientation,
                                                 GraphicsPath path)
        {
            using (Clipping clip = new Clipping(context.Graphics, path))
            {
                // Draw entire background in white
                context.Graphics.FillRectangle(Brushes.White, rect);

                // Offset the drawing rectangle for the top and left
                rect.X++;
                rect.Y++;

                // Size is smaller in both directions because of offseting
                rect.Width--;
                rect.Height--;

                // Draw the second color as the offset background
                using (Brush backBrush = CreateColorBrush(gradientRect,
                                                          backColor1,
                                                          backColor2,
                                                          PaletteColorStyle.Rounded,
                                                          backColorAngle,
                                                          orientation))
                {
                    context.Graphics.FillRectangle(backBrush, rect);
                }
            }
        }
Пример #16
0
        private void DrawBackRounded4(RenderContext context,
                                      Rectangle rect,
                                      Rectangle gradientRect,
                                      Color backColor1,
                                      Color backColor2,
                                      PaletteColorStyle backColorStyle,
                                      float backColorAngle,
                                      VisualOrientation orientation,
                                      GraphicsPath path)
        {
            using (Clipping clip = new Clipping(context.Graphics, path))
            {
                // Use standard helper routine to create appropriate color brush
                using (Brush backBrush = CreateColorBrush(gradientRect, backColor1, backColor2,
                                                          backColorStyle, backColorAngle, orientation))
                {
                    context.Graphics.FillPath(backBrush, path);
                }

                using (Pen linePen = new Pen(backColor1))
                {
                    // Adjust angle for the orientation
                    switch (orientation)
                    {
                        case VisualOrientation.Left:
                            context.Graphics.DrawLine(linePen, rect.Right - 1, rect.Top, rect.Right - 1, rect.Bottom - 1);
                            break;
                        case VisualOrientation.Right:
                            context.Graphics.DrawLine(linePen, rect.Left, rect.Top, rect.Left, rect.Bottom - 1);
                            break;
                        case VisualOrientation.Bottom:
                            context.Graphics.DrawLine(linePen, rect.Left, rect.Top, rect.Right - 1, rect.Top);
                            break;
                        case VisualOrientation.Top:
                            context.Graphics.DrawLine(linePen, rect.Left, rect.Bottom - 1, rect.Right - 1, rect.Bottom - 1);
                            break;
                    }
                }
            }
        }
Пример #17
0
        private void DrawBackOneNote(RenderContext context,
                                     Rectangle gradientRect,
                                     Color backColor1,
                                     Color backColor2,
                                     PaletteColorStyle backColorStyle,
                                     float backColorAngle,
                                     VisualOrientation orientation,
                                     GraphicsPath path)
        {
            // Draw entire background in first color
            using (Brush backBrush = CreateColorBrush(gradientRect,
                                                      backColor1,
                                                      backColor1,
                                                      backColorStyle,
                                                      backColorAngle,
                                                      orientation))
            {
                context.Graphics.FillPath(backBrush, path);
            }

            // Make a copy of the original path, so we can change it
            GraphicsPath insetPath = (GraphicsPath)path.Clone();

            // Offset by 1.5 pixels so the background shows around two of
            // the edges of the background we are about to draw
            switch (orientation)
            {
                case VisualOrientation.Top:
                    insetPath.Transform(new Matrix(1, 0, 0, 1, 1.5f, 1.5f));
                    break;
                case VisualOrientation.Bottom:
                case VisualOrientation.Left:
                    insetPath.Transform(new Matrix(1, 0, 0, 1, 1.5f, -1.5f));
                    break;
                case VisualOrientation.Right:
                    insetPath.Transform(new Matrix(1, 0, 0, 1, -1.5f, 1.5f));
                    break;
            }

            using (Clipping clip = new Clipping(context.Graphics, path))
            {
                // Draw the second color as the offset background
                using (Brush backBrush = CreateColorBrush(gradientRect,
                                                          backColor2,
                                                          backColor2,
                                                          backColorStyle,
                                                          backColorAngle,
                                                          orientation))
                {
                    context.Graphics.FillPath(backBrush, insetPath);
                }
            }

            // Dispose of created resources
            insetPath.Dispose();
        }
Пример #18
0
        private void DrawBackLinearShadow(RenderContext context,
                                          Rectangle rect,
                                          Rectangle gradientRect,
                                          Color backColor1,
                                          Color backColor2,
                                          PaletteColorStyle backColorStyle,
                                          float backColorAngle,
                                          VisualOrientation orientation,
                                          GraphicsPath path)
        {
            // Prevent drawing over that ourside edge
            using (Clipping clip = new Clipping(context.Graphics, rect))
            {
                // Use standard helper routine to create appropriate color brush
                using (Brush backBrush = CreateColorBrush(gradientRect, backColor1, backColor2,
                                                          PaletteColorStyle.Linear, backColorAngle,
                                                          orientation))
                {
                    context.Graphics.FillPath(backBrush, path);
                }

                // Use path gradient to give the outside of the area a shadow effect
                using (PathGradientBrush borderBrush = new PathGradientBrush(path))
                {
                    borderBrush.Blend = _linearShadowBlend;
                    borderBrush.CenterColor = backColor1;
                    borderBrush.SurroundColors = new Color[] { backColor2 };
                    context.Graphics.FillPath(borderBrush, path);
                }
            }
        }
Пример #19
0
        private void DrawBackRounding5(RenderContext context,
                                       Rectangle rect,
                                       Rectangle gradientRect,
                                       Color backColor1,
                                       Color backColor2,
                                       PaletteColorStyle backColorStyle,
                                       float backColorAngle,
                                       VisualOrientation orientation,
                                       GraphicsPath path)
        {
            // We want to ignore the ourside pixel edge, so inflate inwards
            rect.Inflate(-1, -1);

            // Prevent drawing over that ourside edge
            using (Clipping clip = new Clipping(context.Graphics, rect))
            {
                // Use standard helper routine to create appropriate color brush
                using (Brush backBrush = CreateColorBrush(gradientRect, backColor1, backColor2,
                                                          PaletteColorStyle.Rounding5, backColorAngle,
                                                          orientation))
                {
                    context.Graphics.FillPath(backBrush, path);
                }
            }
        }
Пример #20
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;
 }