Ver Mensaje Individual
  #1  
Antiguo 16-10-2013
rodrinig rodrinig is offline
Miembro
 
Registrado: dic 2007
Posts: 28
Reputación: 0
rodrinig Va por buen camino
Pintar DBGrid dependiendo del Valor de un Registro

Hola Foro, que tal, tengo un duda de un mal funcionamiento en el DBGrid, (no por el comp, sino por mi programación). Tengo un cds con un campo que tiene un valor y dependiendo de ese valor pongo el color de la fila. En el sig codigo que hice me hace esto , como me muestra en la imagen adjunto. Este es el codigo:

Ojo esto tiene un timer que va actualizando a cada rato el cds .

Código Delphi [-]
  with Sender as TDBGrid do
  begin
    case cdsDes['OR_TIPO'] of
      1: begin
           Canvas.Brush.Color := tCOLOR(SELF.cdsDesTIO_COLOR.AsString);
           DefaultDrawColumnCell(Rect, DataCol, Column, State);
         end;
      2: begin
           Canvas.Brush.Color := tCOLOR(SELF.cdsDesTIO_COLOR.AsString);
           DefaultDrawColumnCell(Rect, DataCol, Column, State);
         end;
      3: begin
           Canvas.Brush.Color := tCOLOR(SELF.cdsDesTIO_COLOR.AsString);
           DefaultDrawColumnCell(Rect, DataCol, Column, State);
         end;
      5: begin
           Canvas.Brush.Color := tCOLOR(SELF.cdsDesTIO_COLOR.AsString);
           DefaultDrawColumnCell(Rect, DataCol, Column, State);
         end;
      6: begin
           Canvas.Brush.Color := tCOLOR(SELF.cdsDesTIO_COLOR.AsString);
           DefaultDrawColumnCell(Rect, DataCol, Column, State);
         end;
    else
         begin
           Canvas.Brush.Color := tCOLOR(SELF.cdsDesTIO_COLOR.AsString);
           DefaultDrawColumnCell(Rect, DataCol, Column, State);
         end;

Miren que busque pero no puedo hacerlo funcionar.
Muchas gracias por su atencion

Saludos
Rodrigo Iñiguez
Imágenes Adjuntas
Tipo de Archivo: jpg ImagenMal.jpg (34,7 KB, 9 visitas)
Responder Con Cita