public override void Render(RenderContext context)
{
Debug.Assert(context != null);
// Ask each child to render in turn
foreach (ViewBase child in this)
{
// Only render visible children
if (child.Visible)
{
// We need to clip the filler to ensure it does not draw outside its client area
if (child == _viewFiller)
{
// New clipping region is at most our own client size
using (Region combineRegion = new Region(_viewClipRect))
{
// Remember the current clipping region
Region clipRegion = context.Graphics.Clip.Clone();
// Reduce clipping region down by the existing clipping region
combineRegion.Intersect(clipRegion);
// Use new region that restricts drawing to our client size only
context.Graphics.Clip = combineRegion;
child.Render(context);
// Put clipping region back to original setting
context.Graphics.Clip = clipRegion;
}
}
else
child.Render(context);
}
}
}