AnnSelectRect example for C++ Builder

void TForm1::AnnSelectRect(HANNOBJECT hPlgn)
{
   bool bSelected;
   TRect rcSelect;

   LEADAnn1->AnnSelectRect(LEADAnn1->AnnContainer, Rect(10, 10, 200, 100));
   LEADAnn1->AnnSelectPoint(LEADAnn1->AnnContainer, Point(300, 300));
   LEADAnn1->AnnGetSelected(hPlgn, bSelected);
   if(bSelected)
   {
      LEADAnn1->AnnRemove(hPlgn);
      LEADAnn1->AnnSetSelected(hPlgn, false, false);
   }
   else
      LEADAnn1->AnnInsert(LEADAnn1->AnnContainer, hPlgn, false);

   LEADAnn1->AnnGetSelectRect(LEADAnn1->AnnContainer, rcSelect);
   Caption= "Left:" + IntToStr(rcSelect.Left) +
         ", Top:" + IntToStr(rcSelect.Top) +
         ", Width:" + IntToStr(rcSelect.Right - rcSelect.Left) +
         ", Height:" + IntToStr(rcSelect.Bottom - rcSelect.Top);
}