BufferedPaintRenderAnimation function
Applies to: desktop apps only
Paints the next frame of a buffered paint animation.
Syntax
BOOL BufferedPaintRenderAnimation( HWND hwnd, HDC hdcTarget );
Parameters
- hwnd
-
Type: HWND
Handle to the window in which the animations play.
- hdcTarget
-
Type: HDC
Handle of the target DC on which the buffer is animated.
Return value
Type: BOOL
Returns TRUE if the frame has been painted, or FALSE otherwise.
Remarks
If this function returns TRUE, the application should do no further painting. If this function returns FALSE, the application should paint normally.
An application calls this function within its WM_PAINT handler. After BufferedPaintRenderAnimation paints an animation frame, an application will typically continue without performing its usual painting operations. If appropriate, an application may choose to render additional user interface (UI) over the top of the animation. The following code example, to be included as part of a larger body of code, shows how to use the animation painting functions.
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
|
Minimum supported client | Windows Vista |
|---|---|
|
Minimum supported server | Windows Server 2008 |
|
Header |
|
|
DLL |
|
Send comments about this topic to Microsoft
Build date: 3/6/2012
- 4/4/2009
- JT3890786
The Transition duration time should be read like this:
animParams.dwDuration = 0;
GetThemeTransitionDuration(hTheme, iPartId, iStateIdFrom, iStateIdTo, TMT_TRANSITIONDURATIONS, &animParams.dwDuration);
[ Good catch, this will be corrected. -- MSFT ]
- 4/20/2008
- nusi
- 4/28/2008
- Peter Donnelly - MSFT UE