#include <Gdiplus.h>
using namespace Gdiplus;
//声明
Gdiplus::GdiplusStartupInput m_gdiplusStartupInput;
ULONG_PTR m_gdiplusToken;
Image * m_pImage;
//构造
GdiplusStartup(&m_gdiplusToken, &m_gdiplusStartupInput, NULL);
m_pImage= NULL;
CString sPath = _T("images/vk.png");
if (FileExists(sPath))
{
WCHAR buf[128];
wcscpy(buf, CT2CW(sPath));
m_pImage= Image::FromFile(buf);
}
//绘制
Gdiplus::Graphics graphics(dc.GetSafeHdc());
graphics.SetInterpolationMode(InterpolationModeDefault);
graphics.DrawImage(m_pImage, 0, 0, m_rClient.Width(), m_rClient.Height());
//销毁
if (m_pImage)
{
try
{
delete m_pImage;
}
catch (...)
{
}
m_pImage = NULL;
}
GdiplusShutdown(m_gdiplusToken);
时间: 2024-12-26 08:09:56