EnumSegments example for C++ Builder

void __fastcall TForm1::Button2Click(TObject *Sender)
{
   LEADMRC1->EnumSegments ();
   Caption= "Picture segments will be green-hashed";
}
void __fastcall TForm1::LEADMRC1EnumSegments (int nSegId, int SegmentLeft,
      int SegmentTop, int SegmentRight, int SegmentBottom, int nSegType,
      DWORD crTextForeColor, DWORD crTextBackColor)
{
   LEADImage1->DrawFillStyle = bsDiagCross;
   LEADImage1->DrawPenWidth = 6;
   LEADImage1->DrawPenColor = clYellow;
   if (nSegType == SEGMENT_PICTURE)
      LEADImage1->DrawFillColor = clGreen;
   else
      LEADImage1->DrawFillColor = clRed;
   LEADImage1->DrawRectangle (SegmentLeft, SegmentTop, SegmentRight - SegmentLeft, SegmentBottom - SegmentTop);
}