ComponentFactory.Krypton.Toolkit.RenderStandard.DrawSeparator C# (CSharp) Method

DrawSeparator() public method

Perform drawing of a separator glyph.
public DrawSeparator ( RenderContext context, Rectangle displayRect, IPaletteBack paletteBack, IPaletteBorder paletteBorder, Orientation orientation, PaletteState state, bool canMove ) : void
context RenderContext Render context.
displayRect System.Drawing.Rectangle Display area available for drawing.
paletteBack IPaletteBack Background palette details.
paletteBorder IPaletteBorder Border palette details.
orientation Orientation Visual orientation of the content.
state PaletteState State associated with rendering.
canMove bool Can the separator be moved.
return void
        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);
            }
        }
RenderStandard