private void RenderCollapsedPressedBefore(RenderContext context)
{
switch (_lastRibbonShape)
{
default:
case PaletteRibbonShape.Office2007:
{
IPaletteBack paletteBack = _ribbon.StateCommon.RibbonGroupCollapsedButton.PaletteBack;
IPaletteBorder paletteBorder = _ribbon.StateCommon.RibbonGroupCollapsedButton.PaletteBorder;
// Do we need to draw the background?
if (paletteBack.GetBackDraw(PaletteState.Pressed) == 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, PaletteState.Pressed))
{
Padding borderPadding = context.Renderer.RenderStandardBorder.GetBorderRawPadding(paletteBorder, PaletteState.Pressed, VisualOrientation.Top);
// Apply the padding depending on the orientation
Rectangle enclosingRect = CommonHelper.ApplyPadding(VisualOrientation.Top, ClientRectangle, borderPadding);
// Render the background inside the border path
_mementoStandardBack = context.Renderer.RenderStandardBack.DrawBack(context, enclosingRect, borderPath,
paletteBack, VisualOrientation.Top,
PaletteState.Pressed, _mementoStandardBack);
}
}
// Do we need to draw the border?
if (paletteBorder.GetBorderDraw(PaletteState.Pressed) == InheritBool.True)
context.Renderer.RenderStandardBorder.DrawBorder(context, ClientRectangle, paletteBorder,
VisualOrientation.Top, PaletteState.Pressed);
}
break;
case PaletteRibbonShape.Office2010:
{
Rectangle drawRect = ClientRectangle;
IPaletteRibbonBack paletteBack = _ribbon.StatePressed.RibbonGroupCollapsedBack;
IPaletteRibbonBack paletteBorder = _ribbon.StatePressed.RibbonGroupCollapsedBorder;
PaletteState state = PaletteState.Pressed;
// Are we a group inside a context tab?
if ((_ribbon.SelectedTab != null) && !string.IsNullOrEmpty(_ribbon.SelectedTab.ContextName))
state = PaletteState.ContextPressed;
// Draw the group border
_paletteContextBack.SetInherit(paletteBorder);
_mementoRibbonBack1 = context.Renderer.RenderRibbon.DrawRibbonBack(_ribbon.RibbonShape, context, drawRect, state, _paletteContextBack, VisualOrientation.Top, false, _mementoRibbonBack1);
Rectangle backRect = drawRect;
backRect.Inflate(-2, -2);
// Draw the inside background
_mementoRibbonBack2 = context.Renderer.RenderRibbon.DrawRibbonBack(_ribbon.RibbonShape, context, backRect, state, paletteBack, VisualOrientation.Top, false, _mementoRibbonBack2);
}
break;
}
}