// 创建内存DC
CClientDC dc(this);
CDC memdc;
memdc.CreateCompatibleDC(&dc);
CBitmap bmp;
CRect rc;
GetClientRect(&rc);
bmp.CreateCompatibleBitmap(&dc, rc.Width(), rc.Height());
memdc.SelectObject(&bmp);
bmp.DeleteObject();
// 创建GDI+画图对象
Graphics graphics(memdc);
Image image( ToWChar("1.jpg"));
Point ShowMatrix[3] =
{
Point(0, 0),
Point(image.GetWidth(), 0),
Point(0, image.GetHeight())
};
// 开始画图
graphics.DrawImage(&image, ShowMatrix, 3);
dc.BitBlt(0, 0, rc.Width(), rc.Height(), &memdc, 0, 0, SRCCOPY);
// 清理内存
memdc.DeleteDC();
如何在OnPaint里用gdi+实现双缓冲画图
最新推荐文章于 2022-02-25 19:38:17 发布