首页 > 代码库 > GDI+ 双缓存 和 刷新桌面(F5)
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)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。