protected override void OnPaint(PaintEventArgs e)
{
// Create an offscreen graphics object for double buffering
Bitmap offScreenBmp = new Bitmap(this.ClientRectangle.Width, this.ClientRectangle.Height);
using (System.Drawing.Graphics g = Graphics.FromImage(offScreenBmp))
{
g.SmoothingMode = SmoothingMode.HighQuality;
// Draw the control
drawControl(g);
// Draw the image to the screen
e.Graphics.DrawImageUnscaled(offScreenBmp, 0, 0);
}
}