private void PaintEventHandler(object sender, PaintEventArgs e) { if (sender is Control control) { ControlInfo controlInfo = GetControlInfo(control); if (controlInfo?.ParentDraw ?? false) { // We'll paint the control twice with different clip settings. // The first paint will be on the control itself in this event handler, and it will be painted again by the parent control. e.Graphics.SetClip(control.ClientRectangle); } controlRenderer.PaintControl(control, CreateControlPaintArgs(control, e, false)); } }
// Public members public override void PaintControl(Control control, ControlPaintArgs e) { IControlRenderer renderer = GetRenderer(control); if (renderer is null) { PaintGenericControl(e); } else { renderer.PaintControl(control, e); } }