ComponentFactory.Krypton.Toolkit.ViewDrawSplitCanvas.RenderBefore C# (CSharp) Method

RenderBefore() public method

Perform rendering before child elements are rendered.
public RenderBefore ( RenderContext context ) : void
context RenderContext Rendering context.
return void
        public override void RenderBefore(RenderContext context)
        {
            Debug.Assert(context != null);

            // Validate incoming reference
            if (context == null) throw new ArgumentNullException("context");

            RenderBackground(context, ClientRectangle);

            if (_drawCanvas && (_paletteBorder != null))
            {
                // Do we draw the border before the children?
                if (!DrawBorderLast)
                    RenderBorder(context, ClientRectangle);
                else
                {
                    // Drawing border afterwards, and so clip children to prevent drawing
                    // over the corners if they are rounded.  We only clip children if the
                    // border is drawn afterwards.

                    // Remember the current clipping region
                    _clipRegion = context.Graphics.Clip.Clone();

                    GraphicsPath borderPath;

                    // Restrict the clipping to the area inside the canvas border
                    if (DrawTabBorder)
                        borderPath = context.Renderer.RenderTabBorder.GetTabBorderPath(context, ClientRectangle, _paletteBorder, Orientation, State, TabBorderStyle);
                    else
                        borderPath = context.Renderer.RenderStandardBorder.GetBorderPath(context, ClientRectangle, _paletteBorder, Orientation, State);

                    // Create a new region the same as the existing clipping region
                    Region combineRegion = new Region(borderPath);

                    // Reduce clipping region down by our border path
                    combineRegion.Intersect(_clipRegion);
                    context.Graphics.Clip = combineRegion;

                    borderPath.Dispose();
                }
            }
        }