Ver Mensaje Individual
  #3  
Antiguo 05-08-2010
rmora rmora is offline
Miembro
 
Registrado: may 2006
Posts: 10
Reputación: 0
rmora Va por buen camino
Pintar celdas alternas con texto

Cita:
Empezado por Gydba Ver Mensaje
Fijate si este código te ayuda (Tenés que usar el evento DrawDataCell del componente):
Código:
procedure TForm1.DBGrid1DrawDataCell(Sender: TObject; const Rect: TRect; Field: TField; State: TGridDrawState);
var
   iRowNumber : Integer;
begin
   with (Sender as TDBGrid), Canvas do begin
      iRowNumber := (Rect.Top + Rect.Bottom) div ((1+Rect.Bottom - Rect.Top)*2);
         if Odd(iRowNumber) then Brush.Color := clYellow
         else Brush.Color := clWhite;
      FillRect(Rect);
      DefaultDrawDataCell(Rect, Field, State);
   end;
end;
Como dato interesante el componente rxDBGrid de las rxlib tiene propiedades un tanto mas avanzadas que el DBGrid.
Hola amigos, el ejemplo descrito a mi me funciono de maravilla, sin embargo cuando estas celdas tienen texto, el texto desaparece o no se puede visualizar. Por favor podrían decirme como puedo hacer???. Estoy utilizando el componente tRxDBLib.

Gracias de antemano

Última edición por rmora fecha: 05-08-2010 a las 22:29:47.
Responder Con Cita