/// <summary>
/// Draw the canvas border.
/// </summary>
/// <param name="context"></param>
public override void RenderBorder(RenderContext context)
{
// The first and only child is the caption content
ViewDrawContent caption = (ViewDrawContent)this[0];
// Remember current clipping region so we can put it back later
Region clipRegion = context.Graphics.Clip.Clone();
// Exclude the image/short/long text rectangles from being drawn
Region excludeRegion = clipRegion.Clone();
Rectangle imageRect = caption.ImageRectangle(context);
Rectangle shortRect = caption.ShortTextRect(context);
Rectangle longRect = caption.LongTextRect(context);
imageRect.Inflate(1, 1);
shortRect.Inflate(1, 1);
longRect.Inflate(1, 1);
excludeRegion.Exclude(imageRect);
excludeRegion.Exclude(shortRect);
excludeRegion.Exclude(longRect);
// Draw border and restore original clipping region
context.Graphics.Clip = excludeRegion;
base.RenderBorder(context);
context.Graphics.Clip = clipRegion;
}