public override void RenderBefore(RenderContext context)
{
IPaletteBack paletteBack = _ribbon.StateCommon.RibbonGroupDialogButton.PaletteBack;
IPaletteBorder paletteBorder = _ribbon.StateCommon.RibbonGroupDialogButton.PaletteBorder;
IPaletteRibbonGeneral paletteGeneral = _ribbon.StateCommon.RibbonGeneral;
// Do we need to draw the background?
if (paletteBack.GetBackDraw(State) == InheritBool.True)
{
// Get the border path which the background is clipped to drawing within
using (GraphicsPath borderPath = context.Renderer.RenderStandardBorder.GetBackPath(context, ClientRectangle, paletteBorder, VisualOrientation.Top, State))
{
Padding borderPadding = context.Renderer.RenderStandardBorder.GetBorderRawPadding(paletteBorder, State, VisualOrientation.Top);
// Apply the padding depending on the orientation
Rectangle enclosingRect = CommonHelper.ApplyPadding(VisualOrientation.Top, ClientRectangle, borderPadding);
// Render the background inside the border path
_mementoBack = context.Renderer.RenderStandardBack.DrawBack(context, enclosingRect, borderPath,
paletteBack, VisualOrientation.Top,
State, _mementoBack);
}
}
// Do we need to draw the border?
if (paletteBorder.GetBorderDraw(State) == InheritBool.True)
context.Renderer.RenderStandardBorder.DrawBorder(context, ClientRectangle, paletteBorder,
VisualOrientation.Top, State);
// Find the content area inside the button rectangle
Rectangle contentRect = ClientRectangle;
contentRect.Inflate(_contentSize);
// Draw the dialog box launcher glyph in the center
context.Renderer.RenderGlyph.DrawRibbonDialogBoxLauncher(_ribbon.RibbonShape, context, contentRect, paletteGeneral, State);
}