LAnimationWindow::SetPosition

Summary

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

Syntax

#include "ltwrappr.h"

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

Parameters

L_INT nLeft

X coordinate for the origin of the bitmap list item.

L_INT nTop

Y coordinate for the origin of the bitmap list item.

L_UINT 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

Value Meaning
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

Platforms

Win32, x64.

See Also

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 22.0.2023.2.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.