Partager via


BufferedPaintRenderAnimation, fonction (uxtheme.h)

Peint le cadre suivant d’une animation de peinture mise en mémoire tampon.

Syntaxe

BOOL BufferedPaintRenderAnimation(
  HWND hwnd,
  HDC  hdcTarget
);

Paramètres

hwnd

Type : HWND

Gérez la fenêtre dans laquelle les animations sont lues.

hdcTarget

Type : HDC

Handle du contrôleur de domaine cible sur lequel la mémoire tampon est animée.

Valeur retournée

Type : BOOL

Retourne TRUE si le cadre a été peint ou FALSE dans le cas contraire.

Remarques

Si cette fonction retourne TRUE, l’application ne doit pas effectuer de peinture supplémentaire. Si cette fonction retourne FALSE, l’application doit peindre normalement.

Une application appelle cette fonction dans son gestionnaire WM_PAINT . Une fois bufferedPaintRenderAnimation peint un cadre d’animation, une application continue généralement sans effectuer ses opérations de peinture habituelles. Si nécessaire, une application peut choisir d’afficher une interface utilisateur supplémentaire au-dessus de l’animation. L’exemple de code suivant, à inclure dans le cadre d’un plus grand corps de code, montre comment utiliser les fonctions de peinture d’animation.

    if (!_fBufferedPaintInit)
    {
        BufferedPaintInit();
        _fBufferedPaintInit = TRUE;
    }

    // Determine whether the paint message was generated by a softfade animation.
    if (!BufferedPaintRenderAnimation(hWnd, hdc))
    {
        // Initialize buffered paint parameters.
        BP_ANIMATIONPARAMS animParams = {sizeof(BP_ANIMATIONPARAMS)};
        animParams.style = BPAS_LINEAR; 
        animParams.dwDuration = 0;
        GetThemeTransitionDuration(hTheme, iPartId, iStateIdFrom, 
                iStateIdTo, TMT_TRANSITIONDURATIONS, &animParams.dwDuration);

        HDC hdcFrom, hdcTo;
        HANIMATIONBUFFER hbpAnimation = BeginBufferedAnimation(hWnd, hdc, &rc, 
                BPBF_COMPATIBLEBITMAP, NULL, &animParams, &hdcFrom, &hdcTo);
        if (hbpAnimation)
        {
            if (hdcFrom)
            {
                PaintImpl(hdcFrom, iPartId, iStateIdFrom /*, ...*/);
            }
            if (hdcTo)
            {
                PaintImpl(hdcTo, iPartId, iStateIdTo/*, ...*/);
            }

            EndBufferedAnimation(hbpAnimation, TRUE);
        }
        else
        {
            // Default to unbuffered paint
            PaintImpl(hdc, iPartId, iStateIdTo/*, ...*/);
       
        }
    }
    // Else do not paint because the BufferedPaintRenderAnimation function 
    // already did.
}

Spécifications

Requirement Valeur
Client minimum requis Windows Vista [applications de bureau uniquement]
Serveur minimal pris en charge Windows Server 2008 [applications de bureau uniquement]
plateforme cible Fenêtres
Header uxtheme.h
Library Uxtheme.lib
DLL UxTheme.dll