GDI+,使用一个缓冲(我叫它单缓冲,不知道对不对)

来源:互联网 发布:姚期智 知乎 编辑:程序博客网 时间:2024/05/21 06:39
    HDC hdc;//设备DC    HDC buffhdc;//缓冲DC    RECT g_rect;    HBITMAP g_bkbitmap;    GetClientRect(hWnd,&g_rect);    hdc = GetDC(hWnd);//设备DC    buffhdc = CreateCompatibleDC(hdc);//缓冲DC    g_bkbitmap = CreateCompatibleBitmap(hdc,g_rect.right,g_rect.bottom);    SelectObject(buffhdc,g_bkbitmap);    DrawBackdrop(buffhdc);    Drawing(buffhdc);    BitBlt(hdc,0,0,g_rect.right,g_rect.bottom,buffhdc,0,0,SRCCOPY);    DeleteDC(buffhdc);    DeleteObject(g_bkbitmap);    ReleaseDC(hWnd, hdc);