Graphics::D rawImage 方法绘制图像。
语法
Status DrawImage(
  [in]      Image         *image,
  [in, ref] const RectF & rect
);
参数
[in] image
类型: 图像*
指向指定源 图像的 Image 对象的指针。
[in, ref] rect
类型: const RectF
对边框的引用,该矩形绑定图像的绘图区域。
返回值
类型: 状态
如果该方法成功,则返回 Ok,这是 Status 枚举的元素。
如果方法失败,它将返回 Status 枚举的其他元素之一。
注解
将图像进行缩放以适合该矩形。
示例
以下示例绘制源图像,即绑定调整大小后的图像的矩形,然后绘制调整大小的图像以适应矩形。
VOID Example_DrawImage10(HDC hdc)
{
   Graphics graphics(hdc);
   // Create an Image object.
   Image image(L"climber.jpg");
   // Create a Pen object.
   Pen pen (Color(255, 255, 0, 0), 2);
   // Draw the original source image.
   graphics.DrawImage(&image, 10, 10);
   // Create a RectF object that specifies the destination of the image.
   RectF destRect(200, 50, 150, 75);
   // Draw the rectangle that bounds the image.
   graphics.DrawRectangle(&pen, destRect);
   // Draw the image.
   graphics.DrawImage(&image, destRect);
}
下图显示了上述代码的输出。
              
            
要求
| 要求 | 值 | 
|---|---|
| 最低受支持的客户端 | Windows XP、Windows 2000 Professional [仅限桌面应用] | 
| 最低受支持的服务器 | Windows 2000 Server [仅限桌面应用] | 
| 目标平台 | Windows | 
| 标头 | gdiplusgraphics.h (包括 Gdiplus.h) | 
| Library | Gdiplus.lib | 
| DLL | Gdiplus.dll |