AnnSelectRect example for Delphi

Procedure TForm1.AnnSelectRect(hPlgn: HANNOBJECT);
var
   bSelected: Boolean;
   rcSelect: TRect;
begin
   LEADAnn1.AnnSelectRect(LEADAnn1.AnnContainer, Rect(10, 10, 200, 100));
   LEADAnn1.AnnSelectPoint(LEADAnn1.AnnContainer, Point(300, 300));
   LEADAnn1.AnnGetSelected(hPlgn, bSelected);
   if(bSelected)then
   begin
      LEADAnn1.AnnRemove(hPlgn);
      LEADAnn1.AnnSetSelected(hPlgn, False, False);
   end
   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);
end;