Use CreateCompatibleBitmap (): http://msdn.microsoft.com/en-us/library/dd183488%28VS.85%29.aspx[^] In your OnPaint method, you have a device context, which can be used to create a compatible bitmap. You can then draw on this bitmap, then attach it to a CImage object and save it.