Ver Mensaje Individual
  #2  
Antiguo 07-11-2012
Avatar de Neftali [Germán.Estévez]
Neftali [Germán.Estévez] Neftali [Germán.Estévez] is offline
[becario]
 
Registrado: jul 2004
Ubicación: Barcelona - Espańa
Posts: 19.445
Reputación: 10
Neftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en brutoNeftali [Germán.Estévez] Es un diamante en bruto
Revisa ejemplos de los eventos DrawCell o DrawcoloumnCell del DBGrid. Al final se trata de pintar el texto "a mano" dentro de la celda.
Por ejemplo, este es un trozo de código que uso en uno de mis ejemplos, es para pintar un texto dentro de una celda:

Código Delphi [-]

  // Se debe pintar?
  if not (EmptyDS) then begin
    // porcentaje
    DrawRect := Rect;
    InflateRect(DrawRect, -2, -2);
    TDBGrid(Sender).Canvas.Brush.Style := bsClear;
    fLeft2 := DrawRect.Left + (DrawRect.Right - DrawRect.Left) shr 1 -
              (TDBGrid(Sender).Canvas.TextWidth(StrValue) shr 1);
    // Pintar el texto
    TDBGrid(Sender).Canvas.TextRect(DrawRect, fLeft2,
                                    DrawRect.Top + SPACE_TO_CENTER_CELLTEXT, StrValue);
  end;

En este caso lo que hago es "repintar" el texto "a mano" para centrarlo en la celda.
En tu caso es algo similar, pero deberás cambiar los colores a medida que pintas el texto.

Este código está dentro del OnDrawColumnCell.
__________________
Germán Estévez => Web/Blog
Guía de estilo, Guía alternativa
Utiliza TAG's en tus mensajes.
Contactar con el Clubdelphi

P.D: Más tiempo dedicado a la pregunta=Mejores respuestas.
Responder Con Cita