ComponentFactory.Krypton.Ribbon.ViewDrawRibbonGroupRadioButtonImage.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)
        {
            // Take on all the provided area
            ClientRectangle = context.DisplayRectangle;

            // Get the size of the radio button when it is drawn
            Rectangle radioButtonRect = new Rectangle(Point.Empty, _drawRadioButton.GetPreferredSize(context));

            // Decide on correct position within our rectangle
            if (_large)
            {
                // Place horizontal centered at the bottom of area
                radioButtonRect.X = ClientLocation.X + (ClientWidth - radioButtonRect.Width) / 2;
                radioButtonRect.Y = ClientRectangle.Bottom - radioButtonRect.Height;
            }
            else
            {
                // Place vertically centered at the right of area
                radioButtonRect.X = ClientRectangle.Right - radioButtonRect.Width;
                radioButtonRect.Y = ClientLocation.Y + (ClientHeight - radioButtonRect.Height) / 2;
            }

            // Layout the radio button draw element
            context.DisplayRectangle = radioButtonRect;
            _drawRadioButton.Layout(context);
            context.DisplayRectangle = ClientRectangle;
        }