The following example draws an image with its upper-left corner at (10, 10).
C++
VOID Example_DrawImage14(HDC hdc)
{
Graphics graphics(hdc);
// Create an Image object.
Image image(L"snow.jpg");
// Draw the image.
graphics.DrawImage(&image, 10.0f, 10.0f);
}
PowerBASIC
SUB GDIP_DrawImage (BYVAL hdc AS DWORD)
LOCAL hStatus AS LONG
LOCAL pGraphics AS DWORD
LOCAL pImage AS DWORD
LOCAL strFileName AS STRING
hStatus = GdipCreateFromHDC(hdc, pGraphics)
' // Create the Image object
strFileName = UCODE$("climber.jpg")
hStatus = GdipLoadImageFromFile(STRPTR(strFileName), pImage)
' // Draw the image
hStatus = GdipDrawImage(pGraphics, pImage, 10, 10)
' // Cleanup
IF pImage THEN GdipDisposeImage(pImage)
IF pGraphics THEN GdipDeleteGraphics(pGraphics)
END SUB
(http://www.jose.it-berater.org/captures/GdipDrawImage.png)