/// <summary>
 /// Gets the fourth element color.
 /// </summary>
 /// <param name="state">Palette value should be applicable to this state.</param>
 /// <returns>Color value.</returns>
 public Color GetElementColor4(PaletteState state)
 {
     if (Color4 != Color.Empty)
         return Color4;
     else
         return _inheritElementColor.GetElementColor4(state);
 }
        /// <summary>
        /// Gets the fourth color for the element.
        /// </summary>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Color value.</returns>
        public override Color GetElementColor4(PaletteState state)
        {
            if (Apply)
            {
                Color ret = _primary.GetElementColor4(Override ? OverrideState : state);

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

                return(ret);
            }
            else
            {
                return(_backup.GetElementColor4(state));
            }
        }
Example #3
0
 /// <summary>
 /// Gets the fourth element color.
 /// </summary>
 /// <param name="state">Palette value should be applicable to this state.</param>
 /// <returns>Color value.</returns>
 public Color GetElementColor4(PaletteState state)
 {
     if (Color4 != Color.Empty)
     {
         return(Color4);
     }
     else
     {
         return(_inheritElementColor.GetElementColor4(state));
     }
 }
Example #4
0
        /// <summary>
        /// Draw the track bar position glyph.
        /// </summary>
        /// <param name="context">Render context.</param>
        /// <param name="state">Element state.</param>
        /// <param name="elementPalette">Source of palette colors.</param>
        /// <param name="drawRect">Drawing rectangle that should contain the track.</param>
        /// <param name="orientation">Drawing orientation.</param>
        /// <param name="tickStyle">Tick marks that surround the position.</param>
        public override void DrawTrackPositionGlyph(RenderContext context,
                                                    PaletteState state,
                                                    IPaletteElementColor elementPalette,
                                                    Rectangle drawRect,
                                                    Orientation orientation,
                                                    TickStyle tickStyle)
        {
            GraphicsPath outside = null;
            GraphicsPath border = null;
            GraphicsPath inside = null;

            if (orientation == Orientation.Horizontal)
            {
                switch (tickStyle)
                {
                    case TickStyle.None:
                    case TickStyle.Both:
                        CreatePositionPathsBoth(drawRect, ref outside, ref border, ref inside);
                        break;
                    case TickStyle.TopLeft:
                        CreatePositionPathsTop(drawRect, ref outside, ref border, ref inside);
                        break;
                    case TickStyle.BottomRight:
                        CreatePositionPathsBottom(drawRect, ref outside, ref border, ref inside);
                        break;
                }
            }
            else
            {
                switch (tickStyle)
                {
                    case TickStyle.None:
                    case TickStyle.Both:
                        CreatePositionPathsBoth(drawRect, ref outside, ref border, ref inside);
                        break;
                    case TickStyle.TopLeft:
                        CreatePositionPathsLeft(drawRect, ref outside, ref border, ref inside);
                        break;
                    case TickStyle.BottomRight:
                        CreatePositionPathsRight(drawRect, ref outside, ref border, ref inside);
                        break;
                }
            }

            if ((outside != null) && (border != null) && (inside != null))
            {
                using (AntiAlias aa = new AntiAlias(context.Graphics))
                {
                    using(Pen outsidePen = new Pen(elementPalette.GetElementColor1(state)),
                              borderPen = new Pen(elementPalette.GetElementColor2(state)))
                    {
                        context.Graphics.DrawPath(outsidePen, outside);

                        using(SolidBrush insideBrush = new SolidBrush(elementPalette.GetElementColor3(state)))
                            context.Graphics.FillPath(insideBrush, border);

                        context.Graphics.DrawPath(borderPen, border);

                        using (LinearGradientBrush innerBrush = new LinearGradientBrush(inside.GetBounds(),
                                                                                        elementPalette.GetElementColor4(state),
                                                                                        elementPalette.GetElementColor5(state),
                                                                                        90f))
                        {
                            context.Graphics.FillPath(innerBrush, inside);
                        }
                    }
                }

                outside.Dispose();
                border.Dispose();
                inside.Dispose();
            }
        }