GDI+ 双缓存 和 刷新桌面(F5)
Posted K.I.S.S.
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了GDI+ 双缓存 和 刷新桌面(F5)相关的知识,希望对你有一定的参考价值。
GDI+双缓存
POINT currentPoint; GetCursorPos(¤tPoint); HWND hWnd = ::GetDesktopWindow(); int nWidth = GetSystemMetrics(SM_CXSCREEN); int nHeight = GetSystemMetrics(SM_CYSCREEN); RECT r; GetWindowRect(hWnd, &r); Bitmap bmp(nWidth, nHeight); Graphics mem_graphic(&bmp); mem_graphic.SetSmoothingMode(Gdiplus::SmoothingModeHighQuality); static bool bChange = false; Pen p(bChange ? Color(0, 255, 0) : Color(255, 0, 0)); bChange = !bChange; Rect rt(currentPoint.x - 10, currentPoint.y - 10, 20, 20); mem_graphic.DrawEllipse(&p, rt); mem_graphic.DrawLine(&p,rt.X, currentPoint.y, rt.X + rt.Width, currentPoint.y); mem_graphic.DrawLine(&p,currentPoint.x, rt.Y, currentPoint.x , rt.Y + rt.Height); Rect rt_small(currentPoint.x - 5, currentPoint.y - 5, 10, 10); mem_graphic.DrawEllipse(&p, rt_small); HDC hDC= ::GetDC(hWnd); Graphics graphics(hDC); CachedBitmap cachedBmp(&bmp,&graphics); //important graphics.DrawCachedBitmap(&cachedBmp,0,0);
刷新桌面(F5)
::SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST | SHCNF_FLUSH, 0, 0);
以上是关于GDI+ 双缓存 和 刷新桌面(F5)的主要内容,如果未能解决你的问题,请参考以下文章