Hola de nuevo.
Por si te clarifica el funcionamiento, te pongo un código que usa un
TStringGrid para simplificar (aunque el manejo es el mismo).
Agregá un StringGrid y un ListBox a un form.
Ejemplo:
Código:
/* Llenar el StringGrid con valores */
void __fastcall TForm1::FormShow(TObject *Sender)
{
for(int f=0; f < StringGrid1->RowCount; f++)
for(int c=0; c < StringGrid1->ColCount; c++)
StringGrid1->Cells[f][c]= IntToStr(f+c);
}
/* Mostrar selección en ListBox */
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TGridRect GR = StringGrid1->Selection;
AnsiString s;
for(int f=GR.Top; f <= GR.Bottom; f++){
s= "";
for(int c=GR.Left; c <= GR.Right; c++)
s = s + StringGrid1->Cells[f][c];
ListBox1->Items->Add(s);
}
}
Notarás que para recorrer la selección, obtuve la fila inicial y final de GR.Top / GR.Bottom y las columnas inicial y final de GR.Left / GR.Right.
Un saludo.