Ver Mensaje Individual
  #2  
Antiguo 02-03-2009
[coso] coso is offline
Miembro Premium
 
Registrado: may 2008
Ubicación: Girona
Posts: 1.678
Reputación: 0
coso Va por buen camino
se ha dado muchas veces este tema. Te recomiendo que eches un vistazo al foro. De todas maneras, te pongo aqui codigo (es de un componente, modificalo a gusto)

Código Delphi [-]

procedure TUDBGrid.DrawColumnCell(const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
     if (datasource.dataset.recordcount = 0) and (gdSelected in state) then canvas.brush.color := clSilver
     else
     begin
          if (gdSelected in state) then canvas.Brush.Color := ColorSeleccionado
          else
          if   SelectedRows.CurrentRowSelected
          then canvas.Brush.Color := ColorSelecciones
          else
          if   data.RecNo mod 2 = 0
          then canvas.Brush.Color := ColorPar
          else canvas.Brush.Color := ColorImpar;

          canvas.Font.Color := $FFFFFF xor canvas.Brush.Color;
     end;

     DefaultDrawColumnCell(Rect,DataCol,Column,State);
     inherited DrawColumnCell(Rect,DataCol,Column,State);
end;
Responder Con Cita