public override void DrawSeparator(RenderContext context,
Rectangle displayRect,
IPaletteBack paletteBack,
IPaletteBorder paletteBorder,
Orientation orientation,
PaletteState state,
bool canMove)
{
Debug.Assert(context != null);
Debug.Assert(paletteBack != null);
Debug.Assert(paletteBorder != null);
// Validate parameter references
if (context == null) throw new ArgumentNullException("context");
if (paletteBack == null) throw new ArgumentNullException("paletteBack");
if (paletteBorder == null) throw new ArgumentNullException("paletteBorder");
Debug.Assert(context.Control != null);
Debug.Assert(!context.Control.IsDisposed);
// Do we need to draw the background?
if (paletteBack.GetBackDraw(state) == InheritBool.True)
{
// Convert from separator orientation to border orientation value
VisualOrientation borderOrientation = (orientation == Orientation.Horizontal ? VisualOrientation.Top :
VisualOrientation.Left);
// Ask the border renderer for a path that encloses the border
using (GraphicsPath borderPath = context.Renderer.RenderStandardBorder.GetBackPath(context, displayRect, paletteBorder, borderOrientation, state))
{
// Get the padding needed for the drawing area inside the border
Padding borderPadding = context.Renderer.RenderStandardBorder.GetBorderRawPadding(paletteBorder, state, borderOrientation);
// The area available for border drawing if the client rectangle with padding applied
Rectangle enclosingRect = CommonHelper.ApplyPadding(borderOrientation, displayRect, borderPadding);
// Convert from the two state orientation to our four state orientation
VisualOrientation vo = (orientation == Orientation.Horizontal) ? VisualOrientation.Top : VisualOrientation.Left;
// Render the background inside the border path
context.Renderer.RenderStandardBack.DrawBack(context, enclosingRect, borderPath, paletteBack, vo, state, null);
}
}
// Do we need to draw the border?
if (paletteBorder.GetBorderDraw(state) == InheritBool.True)
{
// Convert from the two state orientation to our four state orientation
VisualOrientation vo = (orientation == Orientation.Horizontal) ? VisualOrientation.Top : VisualOrientation.Left;
// Render the border over the background and children
context.Renderer.RenderStandardBorder.DrawBorder(context, displayRect, paletteBorder, vo, state);
}
}