public override void RenderBefore(RenderContext context)
{
// We never draw the background/border for Office 2010 shape QAT
if (_minibar && (_ribbon.RibbonShape == PaletteRibbonShape.Office2010))
return;
IPaletteRibbonBack palette;
PaletteState state = PaletteState.Normal;
Rectangle drawRect = ClientRectangle;
// Get the correct drawing palette
if (_minibar)
{
if (Active)
{
palette = _ribbon.StateCommon.RibbonQATMinibarActive;
if (!OverlapAppButton)
state = PaletteState.CheckedNormal;
}
else
{
palette = _ribbon.StateCommon.RibbonQATMinibarInactive;
state = PaletteState.Disabled;
}
if (OverlapAppButton)
{
// If we need to overlap the app button, then shift left
drawRect.X -= QAT_MINIBAR_LEFT;
drawRect.Width += QAT_MINIBAR_LEFT;
}
else
{
// Otherwise shift right so there is a small gap on the left
drawRect.X += QAT_MINIBAR_LEFT;
drawRect.Width -= QAT_MINIBAR_LEFT;
}
}
else
palette = _ribbon.StateCommon.RibbonQATFullbar;
// Decide if we need to draw onto a composition area
bool composition = (OwnerForm != null) ? OwnerForm.ApplyComposition && OwnerForm.ApplyCustomChrome : false;
// Perform actual drawing
_memento = context.Renderer.RenderRibbon.DrawRibbonBack(_ribbon.RibbonShape, context, drawRect, state, palette, VisualOrientation.Top, composition, _memento);
}