ComponentFactory.Krypton.Ribbon.ViewDrawRibbonTab.Layout C# (CSharp) Méthode

Layout() public méthode

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

            // Ensure that child elements have correct palette state
            CheckPaletteState(context);

            // 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))
            {
                // Reduce display rect by our border size
                Padding layoutBorder = LayoutBorder;
                context.DisplayRectangle = new Rectangle(ClientLocation.X + layoutBorder.Left,
                                                         ClientLocation.Y + layoutBorder.Top,
                                                         ClientWidth - layoutBorder.Horizontal,
                                                         ClientHeight - layoutBorder.Vertical);

                // Let contained content element we layed out
                base.Layout(context);

                // Put back the original display value now we have finished
                context.DisplayRectangle = ClientRectangle;

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