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 (_ribbonButton.ButtonType == GroupButtonType.Split)
{
// Find the start positions of the split areas for both views
int largeSplitTop = _viewLargeImage.ClientRectangle.Bottom + 1;
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;
}
}