L_DispContainerStartAnimation

#include "ltivw.h"

L_LTIVW_API L_INT L_DispContainerStartAnimation(hCellWnd, nStartFrame, nFrameCount, bAnimateAllSubCells, uFlags)

HWND hCellWnd;

/* handle to the cell window */

L_INT nStartFrame;

/* animation start index */

L_INT nFrameCount;

/* animation total frames */

L_BOOL bAnimateAllSubCells;

/* flag */

L_UINT uFlags;

/* reserved for future use */

Starts an animation in the specific cell(s).

Parameter

Description

hCellWnd

A handle to the window that represents the cell on which the function's effect will be applied.

nStartFrame

Value that represents the initial frame to start animation from.

nFrameCount

Value that represents the number of frames that the animation will go through.

bAnimateAllSubCells

Flag that indicates whether to animate all sub-cells (If the cell layout shows more than one frame at a time). Possible values are:

 

Value

Meaning

 

TRUE

Animate all sub-cells.

 

FALSE

Do not animate all sub-cells

uFlags

Reserved for future use. Pass 0.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

The cell(s) must contain multiple frames.

Required DLLs and Libraries

LTIVW

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

L_DispContainerCreate, L_DispContainerDestroy, L_DispContainerStopAnimation, L_DispContainerGetAnimationProperties, L_DispContainerSetAnimationProperties, L_DispContainerIsCellAnimated

Topics:

Implementing Animation

Image Viewer Functions: Implementing Animation

Example

This function starts an animation for the pass nCellIndex, we assumed that the cell with index (nCellIndex) contains multiple frames.

#if defined LEADTOOLS_V17_OR_LATER
L_INT DispContainerStartAnimationExample(HDISPCONTAINER hCon, L_INT nCellIndex)
{
   DISPANIMATIONPROPS DispAnimationProps;
   HBITMAPLIST        hBitmapList;
   L_INT              nCount;

   if (nCellIndex < 0 || nCellIndex > L_DispContainerGetCellCount(hCon, 0))
      return ERROR_INV_PARAMETER;

   HWND hCellWnd = L_DispContainerGetCellWindowHandle(hCon, nCellIndex, 0);


   L_DispContainerGetAnimationProperties(hCellWnd, &DispAnimationProps, 0);

   DispAnimationProps.uInterval = 100;
   DispAnimationProps.uFlags = CONTAINER_ANIMATION_DIRECTION_FORWARD;

   L_DispContainerSetAnimationProperties(hCellWnd, &DispAnimationProps, 0);

   L_DispContainerGetCellBitmapList(hCellWnd, &hBitmapList, 0);
   L_GetBitmapListCount(hBitmapList, (L_UINT*)&nCount);

   if (!L_DispContainerIsCellAnimated(hCellWnd, 0))
      L_DispContainerStartAnimation(hCellWnd, 0, nCount, TRUE, 0);

   return SUCCESS;
}


#else



L_INT DispContainerStartAnimationExample(HDISPCONTAINER hCon, L_INT nCellIndex)
{
   DISPANIMATIONPROPS DispAnimationProps;
   HBITMAPLIST        hBitmapList;
   L_INT              nCount;

   if (nCellIndex < 0 || nCellIndex > L_DispContainerGetCellCount(hCon, 0))
      return ERROR_INV_PARAMETER;

   L_DispContainerGetAnimationProperties(hCon, nCellIndex, &DispAnimationProps, 0);

   DispAnimationProps.uInterval = 100;
   DispAnimationProps.uFlags = CONTAINER_ANIMATION_DIRECTION_FORWARD;

   L_DispContainerSetAnimationProperties(hCon, nCellIndex, &DispAnimationProps, 0);

   L_DispContainerGetCellBitmapList(hCon, nCellIndex, &hBitmapList, 0);
   L_GetBitmapListCount(hBitmapList, (L_UINT*)&nCount);

   if (!L_DispContainerIsCellAnimated(hCon, nCellIndex, 0))
      L_DispContainerStartAnimation(hCon, nCellIndex, 0, nCount, TRUE, 0);

   return SUCCESS;
}


#endif