绘制缓冲绘制动画的下一帧。
Syntax
BOOL BufferedPaintRenderAnimation(
HWND hwnd,
HDC hdcTarget
);
参数
hwnd
类型:HWND
动画在其中播放的窗口的句柄。
hdcTarget
类型: HDC
在其中对缓冲区进行动画处理的目标 DC 的句柄。
返回值
类型: BOOL
如果已绘制帧,则返回 TRUE ;否则返回 FALSE 。
注解
如果此函数返回 TRUE,则应用程序不应进行进一步的绘制。 如果此函数返回 FALSE,则应用程序应正常绘制。
应用程序在其 WM_PAINT 处理程序中调用此函数。 BufferedPaintRenderAnimation 绘制动画帧后,应用程序通常会继续执行其通常的绘制作。 如果适用,应用程序可以选择在动画顶部呈现其他用户界面(UI)。 以下代码示例将作为较大代码正文的一部分包含在内,演示如何使用动画绘制函数。
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.
}
要求
| Requirement | 价值 |
|---|---|
| 最低支持的客户端 | Windows Vista [仅限桌面应用] |
| 支持的最低服务器 | Windows Server 2008 [仅限桌面应用] |
| 目标平台 | Windows操作系统 |
| Header | uxtheme.h |
| Library | Uxtheme.lib |
| DLL | UxTheme.dll |