Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.10.24
LEADTOOLS Raster imaging C++ Class library help

LAnimationWindow::SetPosition

Show in webframe

#include "ltwrappr.h"

L_INT LAnimationWindow::SetPosition(nLeft, nTop, nIndex=ANIM_ALL_ITEMS)

L_INT nLeft;

/* x coordinate for the bitmap list item */

L_INT nTop;

/* y coordinate for the bitmap list item */

L_UINT nIndex;

/* position of the bitmap list item */

Sets the left and top positions for the bitmap item at position nIndex inside the bitmaplist.

Parameter

Description

nLeft

X coordinate for the origin of the bitmap list item.

nTop

Y coordinate for the origin of the bitmap list item.

nIndex

Position of bitmap list item. Possible values are:

 

Value

Meaning

 

ANIM_ALL_ITEMS

[-1] Set the delay for all items in the bitmap list

 

>=0

Set the delay only for the specified item

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

If nIndex = ANIM_ALL_ITEMS, then all bitmap list items will be affected by the new position.

Required DLLs and Libraries

LTDIS
LTDLG
LTEFX
LTFIL
LTIMG
LTSCR
LTTWN

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

Platforms

Win32, x64.

See Also

Functions:

LAnimationWindow::LAnimationWindow, LAnimationWindow::GetPosition, LAnimationWindow::Load, LAnimationWindow::PlayAnimation, Class Members

Example

This example iterates through all bitmap items, gets the current position

for each bitmap using GetPosition method, displays it, sets the new

position using SetPosition so that the images will be shifted diagonally.

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
L_INT LAnimationWindow_SetDisposalMethodExample(HWND hWndParent)
{
   L_INT nRet;
   LBase::LoadLibraries(LT_ALL_LEADLIB);
   //make sure all libraries are loaded
   LAnimationWindow MyAnimation;
   MyAnimation.SetFileName(MAKE_IMAGE_PATH(TEXT("eye.gif")));
   nRet = MyAnimation.Load();
   if (nRet==SUCCESS)
   {
      L_INT nLeft, nTop;
       MyAnimation.CreateWnd(hWndParent,0, WS_VISIBLE|WS_CHILD|WS_BORDER,0,0,300,300);
      
      //change the bitmaps positions 
      for (L_UINT i=0; i<MyAnimation.GetCount(); i++)
      {
         L_TCHAR szStr[255];
         //get current position for each bitmap
         nRet = MyAnimation.GetPosition(&nLeft, &nTop, i);
         if(nRet != SUCCESS)
            return nRet;
         wsprintf(szStr,TEXT("GetPosition[%d] : Left = %d and Top = %d"),i, nLeft, nTop);
         MessageBox(hWndParent, szStr,TEXT("Example"), MB_OK | MB_ICONINFORMATION);
         nLeft +=i;
         nTop +=i;
         //update current position
         nRet = MyAnimation.SetPosition(nLeft, nTop, i);
         if(nRet != SUCCESS)
            return nRet;
         wsprintf(szStr,TEXT("SetPosition[%d] : Left = %d and Top = %d"),i, nLeft, nTop);
         MessageBox(hWndParent, szStr,TEXT("Example"), MB_OK | MB_ICONINFORMATION);
      } 
   }
   else
      return nRet;
   return SUCCESS;
}
Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.