首页 > 代码库 > 双缓冲技术

双缓冲技术

#ifndef _DRAW2D_H#define _DRAW2D_H#include <gdiplus.h>#pragma comment(lib, "gdiplus")using namespace Gdiplus;HWND Draw2D_hwnd;void Draw2D(PVOID pvoid){    Sleep(1);    ULONG_PTR gdipludToken;    GdiplusStartupInput gdiplusInput;    GdiplusStartup(&gdipludToken, &gdiplusInput, NULL);    RECT rect;    HDC hdc = GetDC(Draw2D_hwnd);    GetClientRect(Draw2D_hwnd, &rect);    Bitmap bmp(rect.right, rect.bottom);    SolidBrush brush(Color(255, 255, 255));    Graphics gbmp(&bmp);    Graphics graphics(hdc);    while (1)     {        gbmp.FillRectangle(&brush, 0, 0, rect.right, rect.bottom);        Image min_normal(TEXT("background.png"));        gbmp.DrawImage(&min_normal, 0, 0, min_normal.GetWidth(), min_normal.GetHeight());        graphics.DrawImage(&bmp, 0, 0, rect.right, rect.bottom);    }    ReleaseDC(Draw2D_hwnd, hdc);    GdiplusShutdown(gdipludToken);}#endif

 

双缓冲技术