/// <summary>
        /// Gets the second back color.
        /// </summary>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Color value.</returns>
        public override Color GetBackColor2(PaletteState state)
        {
            if (Apply)
            {
                Color ret = _primary.GetBackColor2(Override ? OverrideState : state);

                if (ret == Color.Empty)
                {
                    ret = _backup.GetBackColor2(state);
                }

                return(ret);
            }
            else
            {
                return(_backup.GetBackColor2(state));
            }
        }
Exemple #2
0
 /// <summary>
 /// Gets the second back color.
 /// </summary>
 /// <param name="state">Palette value should be applicable to this state.</param>
 /// <returns>Color value.</returns>
 public Color GetBackColor2(PaletteState state)
 {
     if (Color2 != Color.Empty)
     {
         return(Color2);
     }
     else
     {
         return(_inherit.GetBackColor2(state));
     }
 }
 /// <summary>
 /// Gets the second back color.
 /// </summary>
 /// <param name="state">Palette value should be applicable to this state.</param>
 /// <returns>Color value.</returns>
 public override Color GetBackColor2(PaletteState state)
 {
     if ((TreeNode != null) && (TreeNode.BackColor != Color.Empty))
     {
         return(TreeNode.BackColor);
     }
     else
     {
         return(_inherit.GetBackColor2(state));
     }
 }
Exemple #4
0
        /// <summary>
        /// Gets the second back color.
        /// </summary>
        /// <param name="style">Background style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Color value.</returns>
        public override Color GetBackColor2(PaletteBackStyle style, PaletteState state)
        {
            IPaletteBack inherit = GetInherit(state);

            if (inherit != null)
            {
                return(inherit.GetBackColor2(state));
            }
            else
            {
                return(Target.GetBackColor2(style, state));
            }
        }
Exemple #5
0
 /// <summary>
 /// Gets the second back color.
 /// </summary>
 /// <param name="state">Palette value should be applicable to this state.</param>
 /// <returns>Color value.</returns>
 public override Color GetBackColor2(PaletteState state)
 {
     return(_inherit.GetBackColor2(state));
 }
Exemple #6
0
 /// <summary>
 /// Gets the second back color.
 /// </summary>
 /// <param name="state">Palette value should be applicable to this state.</param>
 /// <returns>Color value.</returns>
 public override Color GetBackColor2(PaletteState state) => _inherit.GetBackColor2(state);
Exemple #7
0
 /// <summary>
 /// Gets the second back color.
 /// </summary>
 /// <param name="state">Palette value should be applicable to this state.</param>
 /// <returns>Color value.</returns>
 public override Color GetBackColor2(PaletteState state)
 {
     return(CommonHelper.MergeColors(_inherit.GetBackColor2(state), 0.4f, Color.White, 0.6f));
 }
Exemple #8
0
        /// <summary>
        /// Gets the second back color.
        /// </summary>
        /// <param name="style">Background style.</param>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Color value.</returns>
        public override Color GetBackColor2(PaletteBackStyle style, PaletteState state)
        {
            IPaletteBack inherit = GetInherit(state);

            return(inherit?.GetBackColor2(state) ?? Target.GetBackColor2(style, state));
        }
Exemple #9
0
        /// <summary>
        /// Draw background to fill the specified path.
        /// </summary>
        /// <param name="context">Rendering context.</param>
        /// <param name="rect">Target rectangle that encloses path.</param>
        /// <param name="path">Graphics path.</param>
        /// <param name="palette">Palette used for drawing.</param>
        /// <param name="orientation">Visual orientation of the border.</param>
        /// <param name="state">State associated with rendering.</param>
        /// <param name="memento">Cache used for drawing.</param>
        public override IDisposable DrawBack(RenderContext context,
									         Rectangle rect,
									         GraphicsPath path,
									         IPaletteBack palette,
									         VisualOrientation orientation,
									         PaletteState state,
                                             IDisposable memento)
        {
            Debug.Assert(context != null);
            Debug.Assert(path != null);
            Debug.Assert(palette != null);

            // Validate parameter references
            if (context == null) throw new ArgumentNullException("context");
            if (palette == null) throw new ArgumentNullException("palette");

            Debug.Assert(context.Control != null);
            Debug.Assert(!context.Control.IsDisposed);

            // Is there anything to actually draw?
            if ((rect.Width > 0) && (rect.Height > 0))
            {
                // We want to draw using anti aliasing for a nice smooth effect
                using (GraphicsHint smooth = new GraphicsHint(context.Graphics, palette.GetBackGraphicsHint(state)))
                {
                    // Cache commonly used values
                    Image backImage = palette.GetBackImage(state);
                    PaletteImageStyle backImageStyle = palette.GetBackImageStyle(state);
                    PaletteColorStyle backColorStyle = palette.GetBackColorStyle(state);
                    Color backColor1 = palette.GetBackColor1(state);
                    Color backColor2 = palette.GetBackColor2(state);
                    float backColorAngle = palette.GetBackColorAngle(state);

                    // Get the rectangle to use when dealing with gradients
                    Rectangle gradientRect = context.GetAlignedRectangle(palette.GetBackColorAlign(state), rect);

                    switch (backColorStyle)
                    {
                        case PaletteColorStyle.GlassSimpleFull:
                            memento = RenderGlassHelpers.DrawBackGlassSimpleFull(context, rect, backColor1, backColor2, orientation, path, memento);
                            break;
                        case PaletteColorStyle.GlassNormalFull:
                            memento = RenderGlassHelpers.DrawBackGlassNormalFull(context, rect, backColor1, backColor2, orientation, path, memento);
                            break;
                        case PaletteColorStyle.GlassTrackingFull:
                            memento = RenderGlassHelpers.DrawBackGlassTrackingFull(context, rect, backColor1, backColor2, orientation, path, memento);
                            break;
                        case PaletteColorStyle.GlassPressedFull:
                            memento = RenderGlassHelpers.DrawBackGlassPressedFull(context, rect, backColor1, backColor2, orientation, path, memento);
                            break;
                        case PaletteColorStyle.GlassCheckedFull:
                            memento = RenderGlassHelpers.DrawBackGlassCheckedFull(context, rect, backColor1, backColor2, orientation, path, memento);
                            break;
                        case PaletteColorStyle.GlassCheckedTrackingFull:
                            memento = RenderGlassHelpers.DrawBackGlassCheckedTrackingFull(context, rect, backColor1, backColor2, orientation, path, memento);
                            break;
                        case PaletteColorStyle.GlassNormalStump:
                            memento = RenderGlassHelpers.DrawBackGlassNormalStump(context, rect, backColor1, backColor2, orientation, path, memento);
                            break;
                        case PaletteColorStyle.GlassTrackingStump:
                            memento = RenderGlassHelpers.DrawBackGlassTrackingStump(context, rect, backColor1, backColor2, orientation, path, memento);
                            break;
                        case PaletteColorStyle.GlassPressedStump:
                            memento = RenderGlassHelpers.DrawBackGlassPressedStump(context, rect, backColor1, backColor2, orientation, path, memento);
                            break;
                        case PaletteColorStyle.GlassCheckedStump:
                            memento = RenderGlassHelpers.DrawBackGlassCheckedStump(context, rect, backColor1, backColor2, orientation, path, memento);
                            break;
                        case PaletteColorStyle.GlassCheckedTrackingStump:
                            memento = RenderGlassHelpers.DrawBackGlassCheckedTrackingStump(context, rect, backColor1, backColor2, orientation, path, memento);
                            break;
                        case PaletteColorStyle.GlassThreeEdge:
                            memento = RenderGlassHelpers.DrawBackGlassThreeEdge(context, rect, backColor1, backColor2, orientation, path, memento);
                            break;
                        case PaletteColorStyle.GlassNormalSimple:
                            memento = RenderGlassHelpers.DrawBackGlassNormalSimple(context, rect, backColor1, backColor2, orientation, path, memento);
                            break;
                        case PaletteColorStyle.GlassTrackingSimple:
                            memento = RenderGlassHelpers.DrawBackGlassTrackingSimple(context, rect, backColor1, backColor2, orientation, path, memento);
                            break;
                        case PaletteColorStyle.GlassPressedSimple:
                            memento = RenderGlassHelpers.DrawBackGlassPressedSimple(context, rect, backColor1, backColor2, orientation, path, memento);
                            break;
                        case PaletteColorStyle.GlassCheckedSimple:
                            memento = RenderGlassHelpers.DrawBackGlassCheckedSimple(context, rect, backColor1, backColor2, orientation, path, memento);
                            break;
                        case PaletteColorStyle.GlassCheckedTrackingSimple:
                            memento = RenderGlassHelpers.DrawBackGlassCheckedTrackingSimple(context, rect, backColor1, backColor2, orientation, path, memento);
                            break;
                        case PaletteColorStyle.GlassCenter:
                            memento = RenderGlassHelpers.DrawBackGlassCenter(context, rect, backColor1, backColor2, orientation, path, memento);
                            break;
                        case PaletteColorStyle.GlassBottom:
                            memento = RenderGlassHelpers.DrawBackGlassBottom(context, rect, backColor1, backColor2, orientation, path, memento);
                            break;
                        case PaletteColorStyle.GlassFade:
                            memento = RenderGlassHelpers.DrawBackGlassFade(context, rect, backColor1, backColor2, orientation, path, memento);
                            break;
                        case PaletteColorStyle.ExpertTracking:
                            memento = RenderExpertHelpers.DrawBackExpertTracking(context, rect, backColor1, backColor2, orientation, path, memento);
                            break;
                        case PaletteColorStyle.ExpertPressed:
                            memento = RenderExpertHelpers.DrawBackExpertPressed(context, rect, backColor1, backColor2, orientation, path, memento);
                            break;
                        case PaletteColorStyle.ExpertChecked:
                            memento = RenderExpertHelpers.DrawBackExpertChecked(context, rect, backColor1, backColor2, orientation, path, memento);
                            break;
                        case PaletteColorStyle.ExpertCheckedTracking:
                            memento = RenderExpertHelpers.DrawBackExpertCheckedTracking(context, rect, backColor1, backColor2, orientation, path, memento);
                            break;
                        case PaletteColorStyle.ExpertSquareHighlight:
                            memento = RenderExpertHelpers.DrawBackExpertSquareHighlight(context, rect, backColor1, backColor2, orientation, path, memento, false);
                            break;
                        case PaletteColorStyle.ExpertSquareHighlight2:
                            memento = RenderExpertHelpers.DrawBackExpertSquareHighlight(context, rect, backColor1, backColor2, orientation, path, memento, true);
                            break;
                        case PaletteColorStyle.SolidInside:
                            DrawBackSolidInside(context, gradientRect, backColor1, backColor2, path);
                            break;
                        case PaletteColorStyle.SolidLeftLine:
                        case PaletteColorStyle.SolidRightLine:
                        case PaletteColorStyle.SolidTopLine:
                        case PaletteColorStyle.SolidBottomLine:
                        case PaletteColorStyle.SolidAllLine:
                            DrawBackSolidLine(context, rect, backColor1, backColor2, backColorStyle, path);
                            break;
                        case PaletteColorStyle.OneNote:
                            DrawBackOneNote(context, gradientRect, backColor1, backColor2,
                                            backColorStyle, backColorAngle, orientation, path);
                            break;
                        case PaletteColorStyle.RoundedTopLeftWhite:
                            DrawBackRoundedTopLeftWhite(context, rect, gradientRect, backColor1, backColor2,
                                                        backColorStyle, backColorAngle, orientation, path);
                            break;
                        case PaletteColorStyle.RoundedTopLight:
                            DrawBackRoundedTopLight(context, rect, gradientRect, backColor1, backColor2,
                                                    backColorStyle, backColorAngle, orientation, path);
                            break;
                        case PaletteColorStyle.Rounding4:
                            DrawBackRounded4(context, rect, gradientRect, backColor1, backColor2,
                                             backColorStyle, backColorAngle, orientation, path);
                            break;
                        case PaletteColorStyle.Rounding5:
                            DrawBackRounding5(context, rect, gradientRect, backColor1, backColor2,
                                                  backColorStyle, backColorAngle, orientation, path);
                            break;
                        case PaletteColorStyle.LinearShadow:
                            DrawBackLinearShadow(context, rect, gradientRect, backColor1, backColor2,
                                                 backColorStyle, backColorAngle, orientation, path);
                            break;
                        default:
                            // Use standard helper routine to create appropriate color brush
                            using (Brush backBrush = CreateColorBrush(gradientRect, backColor1, backColor2,
                                                                      backColorStyle, backColorAngle, orientation))
                            {
                                context.Graphics.FillPath(backBrush, path);
                            }
                            break;
                    }

                    // Do we need to draw the image?
                    if (ShouldDrawImage(backImage))
                    {
                        // Get the rectangle to use when dealing with gradients
                        Rectangle imageRect = context.GetAlignedRectangle(palette.GetBackImageAlign(state), rect);

                        // Use standard helper routine to create appropriate image brush
                        using (Brush backBrush = CreateImageBrush(imageRect, backImage, backImageStyle))
                            context.Graphics.FillPath(backBrush, path);
                    }
                }
            }

            return memento;
        }
Exemple #10
0
        /// <summary>
        /// Evaluate if transparent painting is needed for background palette.
        /// </summary>
        /// <param name="paletteBack">Background palette to test.</param>
        /// <param name="state">Element state associated with palette.</param>
        /// <returns>True if transparent painting required.</returns>
        public override bool EvalTransparentPaint(IPaletteBack paletteBack,
                                                  PaletteState state)
        {
            // If the background is not being painted, then has transparency
            if (paletteBack.GetBackDraw(state) == InheritBool.False)
                return true;
            else
            {
                // If the first color has alpha channel then has transparency
                if (paletteBack.GetBackColor1(state).A < 255)
                    return true;
                else
                {
                    // Does the draw style require use of the second color?
                    if (paletteBack.GetBackColorStyle(state) != PaletteColorStyle.Solid)
                    {
                        // If the second color has alpha channel then has transparency
                        if (paletteBack.GetBackColor2(state).A < 255)
                            return true;
                    }
                }
            }

            // Cannot find any transparent areas
            return false;
        }
Exemple #11
0
 /// <summary>
 /// Gets the second back color.
 /// </summary>
 /// <param name="state">Palette value should be applicable to this state.</param>
 /// <returns>Color value.</returns>
 public override Color GetBackColor2(PaletteState state) => (TreeNode != null) && (TreeNode.BackColor != Color.Empty) ? TreeNode.BackColor : _inherit.GetBackColor2(state);