AnnGetPoint... example for C++ Builder

// This is an example for the following methods and properties
// AnnGetPointCount method, AnnGetPointX method, AnnGetPointY method
// and Point Property
//In the OnAnnDrawn event, this example checks to see if the annotation object is a polygon.
//If it is a polygon,
//the example gets the number of points that define the object;
//then it gets the Xpoints and YPoints and displays them in a message box.

void __fastcall TForm1::LEADAnn1AnnDrawn (L_HANDLE hObject)
{
   int nType;
   int a;
   long nPoints; //number of points in the object
   AnsiString msg;
   TAnnPoints * XPoints ;
   TAnnPoints * YPoints;

   nType= LEADAnn1->AnnGetType (hObject);
   if (nType == ANNOBJECT_POLYGON ) //Is the object a polygon?
   {
      ShowMessage ("Object is a Polygon");
      nPoints = LEADAnn1->AnnGetPointCount (hObject); //get the number of points
      XPoints= LEADAnn1->AnnGetPointX (hObject); //get the X coordinates
      YPoints= LEADAnn1->AnnGetPointY (hObject); //get the Y coordinates
      msg= "(";
      for (a= 1; a <= nPoints; a ++)
         msg= msg + "{" + FloatToStr(XPoints->Point [a - 1]->X) + "," + FloatToStr(YPoints->Point[a - 1]->Y) + "}";


      msg= "The Polygon's " + IntToStr((int)nPoints) + " points are:\n" + msg + ")";
      ShowMessage ( msg);
      XPoints->Free ();
      YPoints->Free ();
   }
   LEADAnn1->AnnTool = ANNTOOL_SELECT;
}