Partilhar via


Função BufferedPaintRenderAnimation (uxtheme.h)

Pinta o próximo quadro de uma animação de pintura em buffer.

Sintaxe

BOOL BufferedPaintRenderAnimation(
  HWND hwnd,
  HDC  hdcTarget
);

Parâmetros

hwnd

Tipo: HWND

Manipule para a janela na qual as animações são reproduzidas.

hdcTarget

Tipo: HDC

Identificador do DC de destino no qual o buffer é animado.

Valor de retorno

Tipo: BOOL

Retornará TRUE se o quadro tiver sido pintado ou FALSE caso contrário.

Observações

Se essa função retornar TRUE, o aplicativo não deverá fazer nenhuma pintura adicional. Se essa função retornar FALSE, o aplicativo deverá pintar normalmente.

Um aplicativo chama essa função em seu manipulador de WM_PAINT . Depois que BufferedPaintRenderAnimation pintar um quadro de animação, um aplicativo normalmente continuará sem executar suas operações habituais de pintura. Se apropriado, um aplicativo pode optar por renderizar interface do usuário adicional na parte superior da animação. O exemplo de código a seguir, a ser incluído como parte de um corpo maior de código, mostra como usar as funções de pintura de animação.

    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.
}

Requirements

Requirement Value
Cliente mínimo suportado Windows Vista [somente aplicativos da área de trabalho]
Servidor mínimo compatível Windows Server 2008 [somente aplicativos da área de trabalho]
da Plataforma de Destino Windows
Header uxtheme.h
Library Uxtheme.lib
de DLL UxTheme.dll