public void DrawToBitmap (Bitmap bitmap, Rectangle targetBounds)
{
Graphics g = Graphics.FromImage (bitmap);
// Only draw within the target bouds, and up to the size of the control
g.IntersectClip (targetBounds);
g.IntersectClip (Bounds);
// Logic copied from WmPaint
PaintEventArgs pea = new PaintEventArgs (g, targetBounds);
if (!GetStyle (ControlStyles.Opaque))
OnPaintBackground (pea);
OnPaintBackgroundInternal (pea);
OnPaintInternal (pea);
//if (!pea.Handled)
OnPaint (pea);
g.Dispose ();
}