Ver Mensaje Individual
  #3  
Antiguo 25-08-2011
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 38
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
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.
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....

Última edición por ecfisa fecha: 25-08-2011 a las 17:18:14.
Responder Con Cita