public override void Layout(ViewLayoutContext context)
{
Debug.Assert(context != null);
// We take on all the available display area
ClientRectangle = context.DisplayRectangle;
// Find the rectangle available to each child by removing the rounding
Rectangle childRect = ClientRectangle;
// Find the amount of rounding to apply
int rounding = Rounding;
// Apply the rounding in the appropriate orientation
if ((Orientation == VisualOrientation.Top) || (Orientation == VisualOrientation.Bottom))
{
childRect.Width -= rounding * 2;
childRect.X += rounding;
}
else
{
childRect.Height -= rounding * 2;
childRect.Y += rounding;
}
// Inform each child to layout inside the reduced rectangle
foreach (ViewBase child in this)
{
context.DisplayRectangle = childRect;
child.Layout(context);
}
// Remember the set context to the size we were given
context.DisplayRectangle = ClientRectangle;
}