public override void RenderBefore(RenderContext context)
{
Debug.Assert(context != null);
// Validate incoming reference
if (context == null) throw new ArgumentNullException("context");
if (this[0].Visible)
{
// The first and only child is the caption content
ViewDrawContent caption = (ViewDrawContent)this[0];
// Cache the origina client rectangle before we modify it
_cacheClientRect = ClientRectangle;
// Update canvas drawing area by the overlapping caption area
Rectangle captionRect = caption.ClientRectangle;
switch (GetDock(caption))
{
case ViewDockStyle.Top:
if (captionRect.Height > 0)
{
int reduce = (int)(captionRect.Height * CaptionOverlap);
ClientRectangle = new Rectangle(_cacheClientRect.X, _cacheClientRect.Y + reduce, _cacheClientRect.Width, _cacheClientRect.Height - reduce);
}
break;
case ViewDockStyle.Left:
if (captionRect.Width > 0)
{
int reduce = (int)(captionRect.Width * CaptionOverlap);
ClientRectangle = new Rectangle(_cacheClientRect.X + reduce, _cacheClientRect.Y, _cacheClientRect.Width - reduce, _cacheClientRect.Height);
}
break;
case ViewDockStyle.Bottom:
if (captionRect.Height > 0)
{
int reduce = (int)(captionRect.Height * CaptionOverlap);
ClientRectangle = new Rectangle(_cacheClientRect.X, _cacheClientRect.Y, _cacheClientRect.Width, _cacheClientRect.Height - reduce);
}
break;
case ViewDockStyle.Right:
if (captionRect.Width > 0)
{
int reduce = (int)(captionRect.Width * CaptionOverlap);
ClientRectangle = new Rectangle(_cacheClientRect.X, _cacheClientRect.Y, _cacheClientRect.Width - reduce, _cacheClientRect.Height);
}
break;
}
}
base.RenderBefore(context);
}