/// <summary> /// Gets the color for the drop arrow dark color. /// </summary> /// <param name="state">Palette value should be applicable to this state.</param> /// <returns>Color value.</returns> public Color GetRibbonDropArrowDark(PaletteState state) { if (DropArrowDark != Color.Empty) { return(DropArrowDark); } else { return(_inherit.GetRibbonDropArrowDark(state)); } }
/// <summary> /// Perform drawing of a ribbon drop 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> public override void DrawRibbonDropArrow(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 darkColor = (state == PaletteState.Disabled ? paletteGeneral.GetRibbonDisabledDark(state) : paletteGeneral.GetRibbonDropArrowDark(state)); Color lightColor = (state == PaletteState.Disabled ? paletteGeneral.GetRibbonDisabledLight(state) : paletteGeneral.GetRibbonDropArrowLight(state)); switch (shape) { default: case PaletteRibbonShape.Office2007: using (Pen darkPen = new Pen(darkColor), lightPen = new Pen(lightColor)) { context.Graphics.DrawLine(darkPen, displayRect.Left, displayRect.Top, displayRect.Left + 4, displayRect.Top); context.Graphics.DrawLine(darkPen, displayRect.Left + 1, displayRect.Top + 1, displayRect.Left + 3, displayRect.Top + 1); context.Graphics.DrawLine(darkPen, displayRect.Left + 2, displayRect.Top + 1, displayRect.Left + 2, displayRect.Top + 2); context.Graphics.DrawLine(lightPen, displayRect.Left, displayRect.Top + 1, displayRect.Left + 2, displayRect.Top + 3); context.Graphics.DrawLine(lightPen, displayRect.Left + 2, displayRect.Top + 3, displayRect.Left + 4, displayRect.Top + 1); } break; case PaletteRibbonShape.Office2010: using (LinearGradientBrush fillBrush = new LinearGradientBrush(new RectangleF(displayRect.X - 1, displayRect.Y - 1, displayRect.Width + 2, displayRect.Height + 2), lightColor, darkColor, 45f)) { context.Graphics.FillPolygon(fillBrush, new Point[]{ new Point(displayRect.Left - 1, displayRect.Top - 1), new Point(displayRect.Left + 2, displayRect.Top + 3), new Point(displayRect.Left + 5, displayRect.Top) }); } break; } }