AnnHitTestExt example for C++ Builder
//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 hittest is a user handle, additional information about the handle is //displayed.
void TForm1:: ExampleAnnHitTestExt ( HANNOBJECT hObject, HANNOBJECT hContainer, long lPointToTestX,
long lPointToTestY)
{
AnsiString strResult;
LEADAnn1->AnnHitTestExt( hContainer, lPointToTestX, lPointToTestY);
if(LEADAnn1->AnnObjectHitHandle == 0 )
{
ShowMessage ("There is no object to hit test.");
return;
}
switch (LEADAnn1->AnnPositionResult)
{
case ANNHIT_NONE:
strResult = "ANNHIT_NONE";
break;
case ANNHIT_BODY:
strResult = "ANNHIT_NONE";
break;
case ANNHIT_NAME:
strResult = "ANNHIT_NAME";
break;
case ANNHIT_HANDLE:
strResult = "ANNHIT_HANDLE HandleIndex = " + IntToStr(LEADAnn1->AnnHandleIndex) + "\n\t" + "HandleId = " + IntToStr(LEADAnn1->AnnHandleID);
break;
case ANNHIT_USER_HANDLE:
strResult = "ANNHIT_USER_HANDLE HandleIndex = " + IntToStr(LEADAnn1->AnnHandleIndex) + "\n\t" + "HandleId = " + IntToStr(LEADAnn1->AnnHandleID);
break;
}
ShowMessage(strResult);
}