protected Image GetExpandedImage()
{
// create a new image to draw into
Image image = new Bitmap(this.Width, this.Height);
// get a graphics object we can draw into
Graphics g = Graphics.FromImage(image);
IntPtr hDC = g.GetHdc();
// some flags to tell the control how to draw itself
IntPtr flags = (IntPtr) (WmPrintFlags.PRF_CLIENT | WmPrintFlags.PRF_CHILDREN | WmPrintFlags.PRF_ERASEBKGND);
// tell the control to draw itself
NativeMethods.SendMessage(this.Handle, WindowMessageFlags.WM_PRINT, hDC, flags);
// clean up resources
g.ReleaseHdc(hDC);
g.Dispose();
// return the completed animation image
return image;
}