Ver Mensaje Individual
  #4  
Antiguo 30-08-2011
ramonibk ramonibk is offline
Miembro
 
Registrado: may 2004
Posts: 193
Reputación: 20
ramonibk Va por buen camino
<<<<<<<<<< RESUELTO >>>>>>>>>>>>

Al final he optado por lo mas sencillo, he tirado todo abajo y he empezado de cero paso a paso.

Os dejo el código del OnDrawCell por si a alguno le viene bien o se le ocurre algún arreglo mas.

Código Delphi [-]
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
Var
 i : Integer;
begin
  for i:= 0 to ListaFechas.Count-1 do
    with StringGrid1 do
       begin
         If ARow <> 0 Then
           Begin
// Decodifico la fecha que tomo de la lista.         
             DecodeDate(StrToDate(ListaFechas[i]),nYear,nMonth,nDay);
// Comparo la fecha decodificada con las que hay en el calendario.
             If ( StringGrid1.Cells[ACol,ARow]= IntToStr(nDay) ) And (wMes=nMonth) Then
                begin
                  Canvas.Brush.Color:= clRed;
                  Canvas.Font.Color:= clWhite;
                End;
           End;
         If ACol = 6 Then // Los domingos los pintamos en rojo
           Begin
             Canvas.font.Color := clRed;
             Canvas.Font.Style := [fsBold];
           End;
         If gdFixed in State then // Fila superior Dias de la semana en azul
           begin
             Canvas.Brush.Color := clNavy;
             Canvas.Font.Color := clWhite;
             Canvas.Font.Style := [fsBold];
           end;
        Canvas.FillRect(Rect);
        Canvas.TextRect(Rect, Rect.Left + (Rect.Right - Rect.Left - Canvas.TextWidth(Cells[ACol,ARow]) + 1)
                                      div 2, Rect.Top + 2, Cells[ACol,ARow]);
       End;
End;

Última edición por ramonibk fecha: 30-08-2011 a las 10:47:30.
Responder Con Cita