LAnimationWindow::SetPosition

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

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

Help Version 20.0.2019.9.23
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2019 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help