ComponentFactory.Krypton.Ribbon.ViewDrawRibbonGroupColorButton.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);

            // Update our enabled and checked state
            UpdateEnabledState();
            UpdateCheckedState();
            UpdateDropDownState();

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

            // Let child elements layout in given space
            base.Layout(context);

            // For split buttons we need to calculate the split button areas
            if (_ribbonColorButton.ButtonType == GroupButtonType.Split)
            {
                // Find the start positions of the split areas for both views
                int largeSplitTop = _viewLargeImage.ClientRectangle.Bottom + 2;
                int mediumSmallSplitRight = _viewMediumSmallText2Sep2.ClientLocation.X;

                // Update the background/border view so it can draw appropriately
                _viewLarge.SplitRectangle = new Rectangle(ClientLocation.X, largeSplitTop, ClientWidth, ClientRectangle.Bottom - largeSplitTop);
                _viewMediumSmall.SplitRectangle = new Rectangle(mediumSmallSplitRight, ClientLocation.Y, ClientRectangle.Right - mediumSmallSplitRight, ClientHeight);
            }
            else
            {
                _viewLarge.SplitRectangle = Rectangle.Empty;
                _viewMediumSmall.SplitRectangle = Rectangle.Empty;
            }
        }