AnnAddUserHandle example for C++ Builder

//This example adds user handles to the center of the top and bottom lines of a rectangle.
//hRect is a rectangle

void TForm1::ExampleAnnAddUserHandle (HANNOBJECT hObject )
{
   L_INT nObjectType;
   double RectTop;
   double RectLeft;
   double RectWidth;
   double RectHeight;

   nObjectType = LEADAnn1->AnnGetType(hObject);
   if(nObjectType == ANNOBJECT_RECT )
   {
      RectTop = LEADAnn1->AnnRectTop[hObject];
      RectLeft = LEADAnn1->AnnRectLeft[hObject];
      RectWidth = LEADAnn1->AnnRectWidth[hObject];
      RectHeight = LEADAnn1->AnnRectHeight[hObject];

      LEADAnn1->AnnHandle->ID = 100;
      LEADAnn1->AnnHandle->Visible = true;
      LEADAnn1->AnnHandle->PenColor = RGB(0, 0, 0);
      LEADAnn1->AnnHandle->FillColor = RGB(255, 0, 0);
      LEADAnn1->AnnHandle->Shape = ANNHANDLE_SHAPE_CIRCLE;
      LEADAnn1->AnnHandle->Cursor = NULL;

      LEADAnn1->AnnHandle->Flags = ANNHANDLE_ID +
                                  ANNHANDLE_LOCATION +
                                  ANNHANDLE_CONTAINER_COORDINATES +
                                  ANNHANDLE_VISIBLE +
                                  ANNHANDLE_PEN_COLOR +
                                  ANNHANDLE_FILL_COLOR +
                                  ANNHANDLE_SHAPE;

      LEADAnn1->AnnHandle->ContainerX = RectLeft + (RectWidth / 2);
      LEADAnn1->AnnHandle->ContainerY = RectTop;

      LEADAnn1->AnnHandle->ContainerX = RectLeft + (RectWidth / 2);
      LEADAnn1->AnnHandle->ContainerY = RectTop + RectHeight;

      LEADAnn1->AnnAddUserHandle (hObject);
   }
   else
   {
      ShowMessage ("Annotation object must be a rectangle.");
   }
}