LAnnContainer::RestrictCursor

Summary

Restricts the mouse cursor in conjunction with annotation objects.

Syntax

#include "ltwrappr.h"

virtual L_INT LAnnContainer::RestrictCursor(lpRect, pPoint, prcOldClip, bRestrictClient)

Parameters

LPRECT lpRect

Pointer to a RECT structure that contains the rectangle within which the cursor is restricted.

LPPOINT pPoint

Pointer to a POINT structure that contains the point around which the lpRect rectangle is centered.

LPRECT prcOldClip

Pointer to a RECT structure that contains the previous clip rectangle.

L_BOOL bRestrictClient

Flag that specifies whether the cursor is restricted to the client window. Possible values are:

Value Meaning
TRUE Restrict the cursor to the client window.
FALSE Do not restrict the cursor to the client window.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

This function is used to restrict the mouse cursor. It should be used when creating custom annotation objects.

Calling this function always restricts the mouse cursor to the annotation container. However, depending on the arguments passed, the mouse cursor can be restricted further .

This function can be used in the following ways:

Required DLLs and Libraries

Platforms

Win32, x64.

See Also

Functions

Topics

Example

Example for LAnnContainer::Convert, LAnnContainer::RestrictCursor
This example restricts the cursor to 10 pixels on either side
of the bounding box of the annotation object. For example,
if the object is a rectangle, the mouse cursor will be restricted
to an area that is 10 pixels larger than the rectangle.

L_INT LAnnContainer_RestrictCursorExample(LAnnContainer *pLContainer)  
{ 
   L_INT nRet; 
 
   L_UINT uType;  
 
   ANNRECT arcBounds;  
 
   RECT rcBounds;  
 
   HANNOBJECT hContainer;  
 
   RECT rcClipOld;  
 
   uType = pLContainer->GetType(); 
 
   if ((uType != ANNOBJECT_AUTOMATION) && (uType != ANNOBJECT_CONTAINER))  
   { 
 
      nRet = pLContainer->GetTopContainer(&hContainer);  
      if(nRet != SUCCESS) 
         return nRet; 
  
      nRet = pLContainer->GetRect(&arcBounds, NULL);  
      if(nRet != SUCCESS) 
         return nRet; 
 
      nRet = pLContainer->Convert((LPPOINT)&rcBounds, (pANNPOINT)&arcBounds, 2, ANNCONVERT_TO_CLIENT);  
      if(nRet != SUCCESS) 
         return nRet; 
 
      rcBounds.left -= 10;  
 
      rcBounds.top -= 10;  
 
      rcBounds.right += 10;  
 
      rcBounds.bottom += 10;  
 
      nRet = pLContainer->RestrictCursor(&rcBounds,  NULL, &rcClipOld, FALSE);  
      if(nRet != SUCCESS) 
         return nRet; 
 
 
      // When done with restricting cursor, call the line below 
 
      // ClipCursor(&rcClipOld);  
 
   } 
   else 
      return FAILURE;  
 
   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.