Graphics::Graphics(Image*) method (gdiplusgraphics.h)

Creates a Graphics::Graphics object that is associated with an Image object.


void Graphics(
  [in] Image *image


[in] image

Type: Image*

Pointer to an Image object that will be associated with the new Graphics::Graphics object.

Return value



This constructor fails if the Image object is based on a metafile that was opened for reading. The Image::Image(file) and Metafile::Metafile(file) constructors open a metafile for reading. To open a metafile for recording, use a Metafile constructor that receives a device context handle.

This constructor also fails if the image uses one of the following pixel formats:

  • PixelFormatUndefined
  • PixelFormatDontCare
  • PixelFormat1bppIndexed
  • PixelFormat4bppIndexed
  • PixelFormat8bppIndexed
  • PixelFormat16bppGrayScale
  • PixelFormat16bppARGB1555


Minimum supported client Windows XP, Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header gdiplusgraphics.h (include Gdiplus.h)
Library Gdiplus.lib
DLL Gdiplus.dll

See also

Changes in the Programming Model

Getting Started


Graphics Constructors