Ver Mensaje Individual
  #5  
Antiguo 31-10-2012
borlandpablo borlandpablo is offline
Miembro
NULL
 
Registrado: oct 2012
Posts: 37
Reputación: 0
borlandpablo Va por buen camino
Buenas, tuve que variar el código porque seguía dándome errores. También donde me mencionaste. Ahora tengo otro problema. Ahora parece que rellena, pero solo el ultimo registro de la base de datos. Pero si hago un while (para que recorra la base de datos) y poniéndolo en first(primer registro), se vuele loco el programa me lo va a rellenando hipersupermegalento (podría tardar horas en rellenarse el stringgrid). Pienso que a lo mejor no está bien colocado el while o algo, pero no sé donde queda el fallo. Dejo lo que tengo hecho de código.

Código:
void __fastcall TXVista::StringGrid1DrawCell(TObject *Sender, int ACol,
      int ARow, TRect &Rect, TGridDrawState State)
{
   TRect Casilla;

   for(int ACol=1; ACol<=StringGrid1->ColCount; ACol++)
   {
      for(int ARow=1; ARow<=StringGrid1->RowCount; ARow++)
      {
         XDatos->QCatalogos->First();
         while(!XDatos->QCatalogos->Eof)
         {
            if(StringGrid1->Cells[ACol][0] == DateToStr(XDatos->QCatalogosFecha_ini->Value) && StringGrid1->Cells[0][ARow] == XDatos->QCatalogosTitulo->Value)
            {
               StringGrid1->Canvas->Brush->Color=clLime;
               Casilla= StringGrid1->CellRect(ACol, ARow);
               StringGrid1->Canvas->FillRect(Casilla);
            }
            XDatos->QCatalogos->Next();
         }

      }
   }
}
Un saludo.
Responder Con Cita