#include "l_bitmap.h"
L_LTANN_API L_INT L_AnnRestrictCursor(hContainer, lpRect, pPoint, prcOldClip, bRestrictClient)
Restricts the mouse cursor in conjunction with annotation objects.
Handle to the container object
Pointer to a RECT structure that contains the rectangle within which the cursor is restricted .
Pointer to a POINT structure that contains the point around which the lpRect rectangle is centered.
Pointer to a RECT structure that contains the previous clip rectangle.
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. |
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
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:
lpRect
and NULL for pPoint
.To restrict the cursor to a box around pPoint (and the container), pass pPoint and lpRect. This is used to restrict movement when dragging an annotation. The pPoint parameter specifies the location at which the user begins the dragging operation by pressing the mouse button. The lpRect parameter specifies the bounding box of the annotation. Calling this function when the mouse button is pressed restricts movement of the annotation so that no part of the annotation can go outside the container. In the diagram below, the red rectangle is restricted so it cannot move outside the container.
To restrict the cursor to a box (not centered around a point), pass lpRect
and NULL for pPoint
.
bRestrictClient
to TRUE.
Required DLLs and Libraries
Win32, x64.
Example for L_AnnConvert, L_AnnRestrictCursor 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 AnnRestrictCursorExample(HANNOBJECT hObject)
{
L_INT nRet;
L_UINT uType;
ANNRECT arcBounds;
RECT rcBounds;
HANNOBJECT hContainer;
RECT rcClipOld;
nRet = L_AnnGetType(hObject, &uType);
if(nRet != SUCCESS)
return nRet;
if ((uType != ANNOBJECT_AUTOMATION) && (uType != ANNOBJECT_CONTAINER))
{
nRet = L_AnnGetTopContainer(hObject, &hContainer);
if(nRet != SUCCESS)
return nRet;
nRet = L_AnnGetRect(hObject, &arcBounds, NULL);
if(nRet != SUCCESS)
return nRet;
nRet = L_AnnConvert(hObject, (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 = L_AnnRestrictCursor(hContainer, &rcBounds, NULL, &rcClipOld, FALSE);
if(nRet != SUCCESS)
return nRet;
// When done with restricting cursor, call the line below
// ClipCursor(&rcClipOld);
}
return SUCCESS;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document