下面一段代码是 GDI Plus 实现双缓冲比较可行的方法,虽然绘制效果比直接绘制要好一些,不过还不能跟 GDI 的双缓冲方式比肩。

RECT rc;
GetClientRect(g_hwnd,&rc);
Bitmap bmp(int(rc.right),int(rc.bottom));

Graphics bmpGraphics(&bmp);
bmpGraphics.SetSmoothingMode(SmoothingModeAntiAlias);

/*Drawing on bitmap*/
SolidBrush bkBrush(Color(0,0,0));
bmpGraphics.FillRectangle(&bkBrush,0,0,rc.right,rc.bottom);

/*Drawing on DC*/
Graphics graphics(hdc);
/*Important! Create a CacheBitmap object for quick drawing*/
CachedBitmap cachedBmp(&bmp,&graphics);
graphics.DrawCachedBitmap(&cachedBmp,0,0);

原文链接:http://cnbeta2004.blog.163.com/blog/static/602313402010119104451537/

标签: MFC, GDI+, GDI Plus, 双缓冲

添加新评论