Ver Mensaje Individual
  #4  
Antiguo 30-10-2012
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 36
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.

El error se produce, con seguridad, en la línea:
Código:
    TDate FechaCell = StrToDate(StringGrid1->Cells[0][ARow]);
En algún punto, el contenido de Cells[0][ARow] no es un valor susceptible de ser convertido a fecha, situación que sucedería por ejemplo, si en la fila 0 existiesen títulos para las columnas.

Una solución es:
Código:
void __fastcall TForm1::StringGrid1DrawCell(TObject *Sender, int ACol,
      int ARow, TRect &Rect, TGridDrawState State)
{
  TCanvas *CV = static_cast<TCanvas*>(StringGrid1->Canvas);
  TDate FechaCell;

  if (TryStrToDate(StringGrid1->Cells[0][ARow],FechaCell))
    if (FechaCell >= FechaInicio && FechaCell <= FechaFin) {
      CV->Brush->Color = clLime;
      CV->FillRect(Rect);
      CV->TextOut(Rect.Left+1,Rect.top+1,StringGrid1->Cells[ACol][ARow]);
    }
}
(Siempre suponiendo que en la columna 0 del StringGrid haya un contenido de fecha válido.)

Saludos.
__________________
Daniel Didriksen

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

Última edición por ecfisa fecha: 30-10-2012 a las 17:39:08.
Responder Con Cita