以下内容从MSDN中摘抄: Run-time Requirements: The Gdiplus.dll must be copied to the system directory of the user's computer. For information about which operating systems are required to use a particular class or method, see the Requirements section of the documentation for the class or method. GDI+ is available as a redistributable for Windows NT 4.0 SP6, Windows 2000, Windows 98, and Windows Me. To download the latest redistributable, go to http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdkredist.htm.
Run-time Requirements:
The Gdiplus.dll must be copied to the system directory of the user's computer. For information about which operating systems are required to use a particular class or method, see the Requirements section of the documentation for the class or method. GDI+ is available as a redistributable for Windows NT 4.0 SP6, Windows 2000, Windows 98, and Windows Me. To download the latest redistributable, go to http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdkredist.htm.
using namespace Gdiplus;VOID OnPaint(HDC hdc)
{
Graphics graphics(hdc);
Pen pen(Color(255, 0, 0, 255)); graphics.DrawLine(&pen, 0, 0, 200, 100);
}
{
CImageShowDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
//如果没有选择显示图形文件,则不用重绘
if(strOpenFileName.IsEmpty())
return;
//显示当前打开的图像文件的全名
this->GetParent()->SetWindowText(strOpenFileName); //建立图形对象
Graphics graphics(pDC->m_hDC);
//装入图形文件
Image image(ToWChar(strOpenFileName.GetBuffer(strOpenFileName.GetLength())));
Point destPoints[3] =
{
Point(0, 0),
Point(image.GetWidth(), 0),
Point(0, image.GetHeight())
};
Point* pdestPoints = destPoints;
//在指定区域pdestPoints显示图像
graphics.DrawImage(&image, pdestPoints, 3);
}