AnnAddUserHandle example for C++ 5 and later
//'This example adds user handles to the center of the top and bottom lines of a rectangle
//'hRect is a rectangle
void CTutorDlg::ExampleAddAnnUserHandle(long hRect)
{
AnnObjectType ObjectType;
double RectTop;
double RectLeft;
double RectWidth;
double RectHeight;
m_pRasterAnn->AnnGetType(hRect);
ObjectType = m_pRasterAnn->GetAnnType();
if(ObjectType == ANN_OBJECT_RECT )
{
RectTop = m_pRasterAnn->GetAnnRectTop(hRect);
RectLeft = m_pRasterAnn->GetAnnRectLeft(hRect);
RectWidth = m_pRasterAnn->GetAnnRectWidth(hRect);
RectHeight = m_pRasterAnn->GetAnnRectHeight(hRect);
m_pRasterAnn->AnnHandle->ID = 100;
m_pRasterAnn->AnnHandle->EnableVisible = TRUE;
m_pRasterAnn->AnnHandle->PenColor = RGB(0, 0, 0);
m_pRasterAnn->AnnHandle->FillColor = RGB(255, 0, 0);
m_pRasterAnn->AnnHandle->Shape = ANN_HANDLE_SHAPE_CIRCLE;
m_pRasterAnn->AnnHandle->hCursor = NULL;
m_pRasterAnn->AnnHandle->Flags = ANN_HANDLE_ID |
ANN_HANDLE_LOCATION |
ANN_HANDLE_CONTAINER_COORDINATES |
ANN_HANDLE_VISIBLE |
ANN_HANDLE_PEN_COLOR |
ANN_HANDLE_FILL_COLOR |
ANN_HANDLE_SHAPE;
m_pRasterAnn->AnnHandle->ContainerX = RectLeft + (RectWidth / 2);
m_pRasterAnn->AnnHandle->ContainerY = RectTop;
m_pRasterAnn->AnnAddUserHandle (hRect);
m_pRasterAnn->AnnHandle->ContainerX = RectLeft + (RectWidth / 2);
m_pRasterAnn->AnnHandle->ContainerY = RectTop + RectHeight;
}
else
{
MessageBox (TEXT("Annotation object must be a rectangle"));
}
}