public override void RenderBefore(RenderContext context)
{
// If there is a selected tab and it is a context tab use the context specific palette
if ((Ribbon.SelectedTab != null) &&
(!string.IsNullOrEmpty(Ribbon.SelectedTab.ContextName)))
{
_inherit = _ribbon.StateContextCheckedNormal.RibbonGroupArea;
ElementState = PaletteState.ContextCheckedNormal;
}
else
{
_inherit = _ribbon.StateCheckedNormal.RibbonGroupArea;
ElementState = PaletteState.CheckedNormal;
}
Rectangle drawRect = ClientRectangle;
// If we need to show the border outside of the client area?
if (_borderOutside)
{
Padding borderPadding = BorderPadding;
drawRect.X -= borderPadding.Left;
drawRect.Y -= borderPadding.Top;
drawRect.Width += borderPadding.Horizontal;
drawRect.Height += borderPadding.Vertical;
}
else if ((_ribbon.CaptionArea.DrawCaptionOnComposition) &&
(_ribbon.RibbonShape == PaletteRibbonShape.Office2010))
{
// Prevent the left and right edges from being drawn
drawRect.X -= 1;
drawRect.Width += 2;
}
// Use renderer to draw the tab background
_memento = context.Renderer.RenderRibbon.DrawRibbonBack(_ribbon.RibbonShape, context, drawRect, State, this, VisualOrientation.Top, false, _memento);
}