/// <summary>
 /// Gets the color for the extra QAT button light content color.
 /// </summary>
 /// <param name="state">Palette value should be applicable to this state.</param>
 /// <returns>Color value.</returns>
 public Color GetRibbonQATButtonLight(PaletteState state)
 {
     if (QATButtonLightColor != Color.Empty)
     {
         return(QATButtonLightColor);
     }
     else
     {
         return(_inherit.GetRibbonQATButtonLight(state));
     }
 }
        /// <summary>
        /// Gets the color for the extra QAT button light content color.
        /// </summary>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Color value.</returns>
        public override Color GetRibbonQATButtonLight(PaletteState state)
        {
            IPaletteRibbonGeneral inherit = GetInherit(state);

            if (inherit != null)
            {
                return(inherit.GetRibbonQATButtonLight(state));
            }
            else
            {
                return(Target.GetRibbonQATButtonLight(state));
            }
        }
Example #3
0
        /// <summary>
        /// Perform drawing of a ribbon context arrow glyph.
        /// </summary>
        /// <param name="shape">Ribbon shape.</param>
        /// <param name="context">Render context.</param>
        /// <param name="displayRect">Display area available for drawing.</param>
        /// <param name="paletteGeneral">General ribbon palette details.</param>
        /// <param name="state">State associated with rendering.</param>
        /// <param name="qatAbove"></param>
        public override void DrawRibbonContextArrow(PaletteRibbonShape shape,
                                                    RenderContext context,
                                                    Rectangle displayRect,
                                                    IPaletteRibbonGeneral paletteGeneral,
                                                    PaletteState state,
                                                    bool qatAbove)
        {
            Debug.Assert(context != null);
            Debug.Assert(paletteGeneral != null);

            // Validate parameter references
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            if (paletteGeneral == null)
            {
                throw new ArgumentNullException("paletteGeneral");
            }

            Color c1 = qatAbove ?   paletteGeneral.GetRibbonQATButtonLight(state) :
                       paletteGeneral.GetRibbonQATButtonDark(state);

            // If disabled then convert to black and white
            if (state == PaletteState.Disabled)
            {
                c1 = CommonHelper.ColorToBlackAndWhite(c1);
            }

            using (var pen = new Pen(c1))
            {
                if (DpiHelper.Default.DpiScaleFactor > 1.0 && DpiHelper.Default.EnableImagesScaling)
                {
                    context.Graphics.DrawLine(pen, displayRect.Left, displayRect.Top, displayRect.Left + 6, displayRect.Top);
                    context.Graphics.DrawLine(pen, displayRect.Left, displayRect.Top + 3, displayRect.Left + 6, displayRect.Top + 3);
                    context.Graphics.DrawLine(pen, displayRect.Left + 1, displayRect.Top + 4, displayRect.Left + 5, displayRect.Top + 4);
                    context.Graphics.DrawLine(pen, displayRect.Left + 2, displayRect.Top + 5, displayRect.Left + 4, displayRect.Top + 5);
                    pen.DashStyle = DashStyle.Dot; // draw one pixel!
                    context.Graphics.DrawLine(pen, displayRect.Left + 3, displayRect.Top + 6, displayRect.Left + 4, displayRect.Top + 6);
                }
                else
                {
                    context.Graphics.DrawLine(pen, displayRect.Left, displayRect.Top, displayRect.Left + 4, displayRect.Top);
                    context.Graphics.DrawLine(pen, displayRect.Left, displayRect.Top + 3, displayRect.Left + 4, displayRect.Top + 3);
                    context.Graphics.DrawLine(pen, displayRect.Left + 1, displayRect.Top + 4, displayRect.Left + 3, displayRect.Top + 4);
                    context.Graphics.DrawLine(pen, displayRect.Left + 2, displayRect.Top + 4, displayRect.Left + 2, displayRect.Top + 5);
                }
            }
        }
Example #4
0
        /// <summary>
        /// Gets the color for the extra QAT button light content color.
        /// </summary>
        /// <param name="state">Palette value should be applicable to this state.</param>
        /// <returns>Color value.</returns>
        public override Color GetRibbonQATButtonLight(PaletteState state)
        {
            IPaletteRibbonGeneral inherit = GetInherit(state);

            return(inherit?.GetRibbonQATButtonLight(state) ?? Target.GetRibbonQATButtonLight(state));
        }
Example #5
0
        /// <summary>
        /// Perform drawing of a ribbon overflow image.
        /// </summary>
        /// <param name="shape">Ribbon shape.</param>
        /// <param name="context">Render context.</param>
        /// <param name="displayRect">Display area available for drawing.</param>
        /// <param name="paletteGeneral">General ribbon palette details.</param>
        /// <param name="state">State associated with rendering.</param>
        public override void DrawRibbonOverflow(PaletteRibbonShape shape,
                                                RenderContext context,
                                                Rectangle displayRect,
                                                IPaletteRibbonGeneral paletteGeneral,
                                                PaletteState state)
        {
            Debug.Assert(context != null);
            Debug.Assert(paletteGeneral != null);

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

            Color c1 = paletteGeneral.GetRibbonQATButtonDark(state);
            Color c2 = paletteGeneral.GetRibbonQATButtonLight(state);

            // Office 2010 uses the same color for both parts
            if (shape == PaletteRibbonShape.Office2010)
                c2 = c1;

            // If disabled then convert to black and white
            if (state == PaletteState.Disabled)
            {
                c1 = CommonHelper.ColorToBlackAndWhite(c1);
                c2 = CommonHelper.ColorToBlackAndWhite(c2);
            }

            using (Pen darkPen = new Pen(c1),
                       lightPen = new Pen(c2))
            {
                context.Graphics.DrawLine(darkPen, displayRect.Left, displayRect.Top + 1, displayRect.Left, displayRect.Top + 3);
                context.Graphics.DrawLine(darkPen, displayRect.Left + 1, displayRect.Top + 2, displayRect.Left, displayRect.Top + 3);
                context.Graphics.DrawLine(lightPen, displayRect.Left, displayRect.Top, displayRect.Left + 2, displayRect.Top + 2);
                context.Graphics.DrawLine(lightPen, displayRect.Left + 1, displayRect.Top + 3, displayRect.Left, displayRect.Top + 4);

                context.Graphics.DrawLine(darkPen, displayRect.Left + 4, displayRect.Top + 1, displayRect.Left + 4, displayRect.Top + 3);
                context.Graphics.DrawLine(darkPen, displayRect.Left + 5, displayRect.Top + 2, displayRect.Left + 4, displayRect.Top + 3);
                context.Graphics.DrawLine(lightPen, displayRect.Left + 4, displayRect.Top, displayRect.Left + 6, displayRect.Top + 2);
                context.Graphics.DrawLine(lightPen, displayRect.Left + 5, displayRect.Top + 3, displayRect.Left + 4, displayRect.Top + 4);
            }
        }