ComponentFactory.Krypton.Ribbon.ViewDrawRibbonContextTitle.RenderBefore C# (CSharp) Method

RenderBefore() public method

Perform rendering before child elements are rendered.
public RenderBefore ( RenderContext context ) : void
context ComponentFactory.Krypton.Toolkit.RenderContext Rendering context.
return void
        public override void RenderBefore(RenderContext context)
        {
            // Office 2010 draws a shadow effect of the text
            if ((_ribbon.RibbonShape == PaletteRibbonShape.Office2010) && (_mementoContentShadow1 != null))
            {
                PaletteState state = (_ribbon.Enabled ? PaletteState.Normal : PaletteState.Disabled);

                // Use renderer to draw the tab background
                _mementoBack = context.Renderer.RenderRibbon.DrawRibbonTabContextTitle(_ribbon.RibbonShape, context, ClientRectangle, _ribbon.StateCommon.RibbonGeneral, this, _mementoBack);

                Rectangle shadowTextRect1 = new Rectangle(_textRect.X - 1, _textRect.Y + 1, _textRect.Width, _textRect.Height);
                Rectangle shadowTextRect2 = new Rectangle(_textRect.X + 1, _textRect.Y + 1, _textRect.Width, _textRect.Height);

                _contentProvider.OverrideTextColor = Color.FromArgb(128, ControlPaint.Dark(GetRibbonBackColor1(PaletteState.Normal)));

                if (DrawOnComposition)
                    _contentProvider.OverrideTextHint = PaletteTextHint.SingleBitPerPixelGridFit;

                context.Renderer.RenderStandardContent.DrawContent(context, shadowTextRect1,
                                                                   _contentProvider, _mementoContentShadow1,
                                                                   VisualOrientation.Top,
                                                                   state, false, true);

                context.Renderer.RenderStandardContent.DrawContent(context, shadowTextRect1,
                                                                   _contentProvider, _mementoContentShadow2,
                                                                   VisualOrientation.Top,
                                                                   state, false, true);

                _contentProvider.OverrideTextColor = Color.Empty;

                // Use renderer to draw the text content
                if (_mementoContentText != null)
                    context.Renderer.RenderStandardContent.DrawContent(context, _textRect,
                                                                       _contentProvider, _mementoContentText,
                                                                       VisualOrientation.Top,
                                                                       state, false, true);

                _contentProvider.OverrideTextHint = PaletteTextHint.Inherit;
            }
            else
            {
                if (DrawOnComposition)
                    RenderOnComposition(context);
                else
                {
                    PaletteState state = (_ribbon.Enabled ? PaletteState.Normal : PaletteState.Disabled);

                    // Use renderer to draw the tab background
                    _mementoBack = context.Renderer.RenderRibbon.DrawRibbonTabContextTitle(_ribbon.RibbonShape, context, ClientRectangle, _ribbon.StateCommon.RibbonGeneral, this, _mementoBack);

                    // Use renderer to draw the text content
                    if (_mementoContentText != null)
                        context.Renderer.RenderStandardContent.DrawContent(context, _textRect,
                                                                           _contentProvider, _mementoContentText,
                                                                           VisualOrientation.Top,
                                                                           state, DrawOnComposition, true);
                }
            }
        }