#include "l_bitmap.h"
L_LTANN_API L_INT L_AnnHitTest(hObject, pPoint, puResult, phObjectHit, pHitTestInfo, uStructSize)
This function gets the handle to the annotation object that is located at a specified point. (If objects overlap, it gets the front object.) and additional information about the annotation object handle if the handle is a default or user-defined handle.
Handle to the container object that sets the scope of the search.
Pointer to the POINT structure that specifies the point to test. Coordinates are relative to the associated window's client area.
The position on the annotation object that was found at the specified point. Possible values are:
ANNHIT_NONE [0]
ANNHIT_BODY [1]
ANNHIT_HANDLE [2]
ANNHIT_NAME [3]
ANNHIT_USER_HANDLE [4]
ANNHIT_ROTATE_HANDLE [5]
ANNHIT_MULTISELECT_HANDLE [6]
ANNHIT_MULTISELECT_ROTATE_HANDLE [7]
ANNHIT_MULTISELECT_BODY [8]
If (*puResult) is updated with ANNHIT_HANDLE or ANNHIT_USER_HANDLE, then pHitTestInfo
contains additional information about the annotation object handle. For example, if (*puResult) is ANNHIT_ROTATE_HANDLE, pHitTestInfo->nHandleID will be either ROTATE_HANDLE_CENTER_ID[100] or ROTATE_HANDLE_GRIPPER_ID[101] to identify which rotate handle was hit.
Address of the variable to be updated with the handle to the annotation object that is found at the specified point.
Pointer to an ANNHITTESTINFO structure that provides hit test information whenever (*puResult
) is updated with ANNHIT_HANDLE or ANNHIT_USER_HANDLE.
Size in bytes, of the structure pointed to by pHitTestInfo
, for versioning. Use sizeof(ANNHITTESTINFO).
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Before calling this function, you must declare a variable of data type HANNOBJECT. You can then pass the address of the variable in the phObjectHit
parameter, which this function will update with the handle of the object located at the specified point.
Required DLLs and Libraries
Win32, x64.
This example uses the caller’s mouse coordinates to get the handle
to the annotation object at the specified coordinates.
The part of the clicked annotation is displayed in the Output window.
If the result of the hit test is a user handle, additional information about the handle is displayed.
L_INT AnnHitTestExample(HANNOBJECT hContainer,
POINT ptPointToTest)
{
L_TCHAR szMsg[200];
L_TCHAR szHitTestInfo[200];
ANNHITTESTINFO HitTestInfo;
L_TCHAR* pszResult = TEXT("");
L_INT nRet;
// This function determines which annotation object you have clicked.
HANNOBJECT hObject; // Local variable for the annotation object
L_UINT uResult; // Result of the test
// Get the object at the specified point
memset(&HitTestInfo, 0, sizeof(ANNHITTESTINFO));
HitTestInfo.uStructSize = sizeof(ANNHITTESTINFO);
nRet = L_AnnHitTest(hContainer, &ptPointToTest, &uResult, &hObject, &HitTestInfo, sizeof(ANNHITTESTINFO));
if (nRet != SUCCESS)
return nRet;
switch(uResult)
{
case ANNHIT_NONE:
pszResult = TEXT("ANNHIT_NONE");
break;
case ANNHIT_BODY:
pszResult = TEXT("ANNHIT_BODY");
break;
case ANNHIT_NAME:
pszResult = TEXT("ANNHIT_NAME");
break;
case ANNHIT_HANDLE:
wsprintf(szHitTestInfo, TEXT("ANNHIT_HANDLE nHandleIndex[%d], nHandleID[%d]"),
HitTestInfo.nHandleIndex, HitTestInfo.nHandleID);
pszResult = szHitTestInfo;
break;
case ANNHIT_USER_HANDLE:
wsprintf(szHitTestInfo, TEXT("ANNHIT_USER_HANDLE nHandleIndex[%d], nHandleID[%d]"),
HitTestInfo.nHandleIndex, HitTestInfo.nHandleID);
pszResult = szHitTestInfo;
break;
}
wsprintf(szMsg, TEXT("[%x] %s\n"), hObject, pszResult);
OutputDebugString(szMsg);
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