Freigeben über


Graphics.DrawImage(Image*, INT, INT) method

Applies to: desktop apps only

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

Syntax

Status DrawImage(
  [in]  Image *image,
  [in]  INT x,
  [in]  INT y
);

Parameters

  • image [in]
    Type: Image*

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

  • x [in]
    Type: INT

    Integer that specifies the x-coordinate of the upper-left corner of the rendered image.

  • y [in]
    Type: INT

    Integer that specifies the y-coordinate of the upper-left corner of the rendered image.

Return value

Type:

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.

Examples

The following example draws an image with its upper-left corner at (0, 0).

VOID Example_DrawImage11(HDC hdc)

{
   Graphics graphics(hdc);

   // Create an Image object.
   Image image(L"climber.jpg");

   // Draw the image.
   graphics.DrawImage(&image, 0, 0);
}

Requirements

Minimum supported client

Windows XP, Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Product

GDI+ 1.0

Header

Gdiplusgraphics.h (include Gdiplus.h)

Library

Gdiplus.lib

DLL

Gdiplus.dll

See also

Graphics

Image

Loading and Displaying Bitmaps

Drawing, Positioning, and Cloning Images

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012