AnnGetAngle example for C++ Builder

void TForm1::AnnGetAngle()
{
   HANNOBJECT hProtractor = 0;
   HANNOBJECT hPolygon = 0;
   ANNPOINT points[4];
   L_UINT uArea;
   L_DOUBLE dAngle;

   LEADAnn1->AnnCreateItem(LEADAnn1->AnnContainer, ANNOBJECT_PROTRACTOR, true, hProtractor);
   LEADAnn1->AnnCreateItem(LEADAnn1->AnnContainer, ANNOBJECT_POLYGON, true, hPolygon);
   // Assign values for x and y from 1 through 3
   points[1].X= 10;
   points[1].Y= 20;
   points[2].X= 100;
   points[2].Y= 200;
   points[3].X= 200;
   points[3].Y= 100;
   LEADAnn1->AnnSetPoints(hProtractor, points+1, 3);
   points[0].X= 50;
   points[0].Y= 220; // SetPoints starts at 0 because No. of points set to 4
   LEADAnn1->AnnSetPoints(hPolygon, points, 4);
   LEADAnn1->AnnSetFillMode(hPolygon, ANNFILLMODE_OPAQUE, False);
   Caption= AnsiString("Protractor Bounding Rectangle") +
            ", Left:" + IntToStr(LEADAnn1->AnnBoundingRectLeft[hProtractor]) +
            ", Top:" + IntToStr(LEADAnn1->AnnBoundingRectTop[hProtractor]) +
            ", Width:" + IntToStr(LEADAnn1->AnnBoundingRectWidth[hProtractor]) +
            ", Height:" + IntToStr(LEADAnn1->AnnBoundingRectHeight[hProtractor]);
   LEADAnn1->AnnBringToFront(hPolygon);
   ShowMessage("Brought Polygon to front");
   LEADAnn1->AnnGetArea(hPolygon, uArea);
   Caption= "Polygon Area:" + IntToStr(uArea);
   LEADAnn1->AnnSendToBack(hPolygon);
   ShowMessage("Sent Polygon to back");
   LEADAnn1->AnnCut(hPolygon, ANNFMT_WMF, false, true);
   dAngle= 0;
   LEADAnn1->AnnGetAngle(hProtractor, dAngle);
   Caption= "Angle:" + FloatToStr(dAngle);
}