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;
}
}