protected internal override void RenderRecursive(DrawingContext dc) { base.RenderRecursive(dc); PostRenderEventHandler postRenderHandler = this._postRenderHandler; if (postRenderHandler == null) { return; } postRenderHandler(dc); }
/// <summary> /// Renders an individual 'part' of the control knob /// </summary> /// <param name="e"></param> /// <param name="bounds">Bounding rectangle</param> /// <param name="preRender">User PreRender callout</param> /// <param name="postRender">User PostRender callout</param> /// <param name="internalRender">Internal render callout</param> private void RenderPart(PaintEventArgs e, Rectangle bounds, PreRenderEventHandler preRender, PostRenderEventHandler postRender, InternalRender internalRender) { bool cancel = false; // If the user wants to PreRender the control // then callout to their associated handler if (preRender != null) { PreRenderEventArgs ev = new PreRenderEventArgs(e.Graphics, e.ClipRectangle, bounds); preRender(this, ev); cancel = ev.Cancel; } // If our internal rendering was not canceled // by the user (via the PreRender event), then // perform our own rendering of the control if (cancel == false) { internalRender(e); // If the user cancelled our internal rendering // then their is no need to PostRender, but if not // then we need to give them another shot at the // rendering process if (postRender != null) { PostRenderEventArgs ev = new PostRenderEventArgs(e.Graphics, e.ClipRectangle, bounds); postRender(this, ev); } } }