Graphics::DrawImage(Image*,constRectF&,constRectF&,Unit,constImageAttributes*) method (gdiplusgraphics.h)

The Graphics::DrawImage method draws a specified portion of an image at a specified location.

Syntax

Status DrawImage(
  [in]      Image                 *image,
  [in, ref] const RectF &         destRect,
  [in, ref] const RectF &         sourceRect,
  [in]      Unit                  srcUnit,
  [in]      const ImageAttributes *imageAttributes
);

Parameters

[in] image

Type: Image*

Pointer to an Image object that specifies the image to be drawn.

[in, ref] destRect

Type: RectF

Rectangle, measured in pixels, that specifies the bounds of the rendered image. The portion of the image specified by sourceRect is scaled to fill the rectangle specified by destRect.

[in, ref] sourceRect

Type: RectF

Rectangle that specifies the portion of the image to be drawn.

[in] srcUnit

Type: Unit

Element of the Unit enumeration that specifies the unit of measure for the source rectangle.

[in] imageAttributes

Type: ImageAttributes*

Optional. Pointer to an ImageAttributes object that specifies color adjustments to be applied when the image is rendered. The default value is NULL.

Return value

Type: Status

If the method succeeds, it returns Ok, which is an element of the Status enumeration.

If the method fails, it returns one of the other elements of the Status enumeration.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Target Platform Windows
Header gdiplusgraphics.h (include Gdiplus.h)
Library Gdiplus.lib
DLL Gdiplus.dll

See also

Drawing, Positioning, and Cloning Images

Graphics

Image

Loading and Displaying Bitmaps