ComponentFactory.Krypton.Ribbon.ViewDrawRibbonGroupRadioButtonText.Layout C# (CSharp) Method

Layout() public method

Perform a layout of the elements.
public Layout ( ViewLayoutContext context ) : void
context ComponentFactory.Krypton.Toolkit.ViewLayoutContext Layout context.
return void
        public override void Layout(ViewLayoutContext context)
        {
            Debug.Assert(context != null);

            // We take on all the available display area
            ClientRectangle = context.DisplayRectangle;

            // A change in state always causes a size and layout calculation
            if (_cacheState != State)
            {
                MakeDirty();
                _cacheState = State;
            }

            // Do we need to actually perform the relayout?
            if ((_displayRect != ClientRectangle) ||
                (_ribbon.DirtyPaletteCounter != _dirtyPaletteLayout))
            {
                // Remember to dispose of old memento
                if (_memento != null)
                {
                    _memento.Dispose();
                    _memento = null;
                }

                Rectangle drawRect = ClientRectangle;

                // Adjust the client rect so the text has enough room to be drawn
                drawRect.Height += _heightExtra;
                drawRect.Y -= (_heightExtra / 2);

                // Use the renderer to layout the text
                _memento = context.Renderer.RenderStandardContent.LayoutContent(context, drawRect,
                                                                                _contentProvider, this,
                                                                                VisualOrientation.Top,
                                                                                PaletteState.Normal, false);

                // Cache values that are needed to decide if layout is needed
                _displayRect = ClientRectangle;
                _dirtyPaletteLayout = _ribbon.DirtyPaletteCounter;
            }
        }