GDI+ double mise en tampon en C++

Je n'ai pas écrit quoi que ce soit avec GDI pour un certain temps maintenant (et jamais avec GDI+), et je suis en train de travailler sur un projet amusant, mais pour la vie de moi, je peux pas comprendre comment le double tampon GDI+

void DrawStuff(HWND hWnd) {
    HDC          hdc;
    HDC          hdcBuffer;
    PAINTSTRUCT  ps;
    hdc = BeginPaint(hWnd, &ps);
    hdcBuffer = CreateCompatibleDC(hdc);
    Graphics graphics(hdc);
    graphics.Clear(Color::Black);

    //drawing stuff, i.e. bunnies:

    Image bunny(L"bunny.gif");
    graphics.DrawImage(&bunny, 0, 0, bunny.GetWidth(), bunny.GetHeight());  

    BitBlt(hdc, 0,0, WIDTH , HEIGHT, hdcBuffer, 0,0, SRCCOPY);
    EndPaint(hWnd, &ps);
}

Les travaux ci-dessus (le tout rend très bien), mais il scintille. Si je change Graphics graphics(hdc); à Graphics graphics(hdcBuffer);, je ne vois rien (bien que je devrais être bitblt avec le tampon->hWnd hdc en bas).

Mon message pipeline est correctement configuré (WM_PAINT appels DrawStuff), et je suis en forçant un message WM_PAINT chaque boucle du programme en appelant RedrawWindow(window, NULL, NULL, RDW_ERASE | RDW_INVALIDATE | RDW_UPDATENOW);

Je vais probablement sur la mauvaise voie pour ce faire, des idées? La documentation MSDN est cryptique au mieux.

OriginalL'auteur David Titarenco | 2010-03-18