Ver Mensaje Individual
  #5  
Antiguo 23-01-2006
josem josem is offline
Miembro
 
Registrado: mar 2004
Posts: 23
Reputación: 0
josem Va por buen camino
Pintar una fila en un DbGrid

Hola, espero que este ejemplo te sirva.

Saludos
Jose Miguel

procedure TFMntInventario.DBGrid1DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
var
iDif : Extended;
iFile: Extended;
begin
// Cambia color a Existencia por debajo del minimo
if ( Dt1.TInventario.FieldByName('ExistAct').AsInteger <
Dt1.TInventario.FieldByName('ExistMin').AsInteger ) then begin
DBGrid1.Canvas.Font.Color := clRed;
end;

// Cambia color a inventario inactivo
if ( SoloNumeros(Dt1.TInventario.FieldByName('Activo').AsString, 0) = '0' ) then begin
DBGrid1.Canvas.Font.Color := clSilver;
end;
if ( FCampoJPG( Dt1.TInventario, 'ActivaVencto' )) then begin
iDif := StrToDate(FormatFecha(Dt1.TInventario.FieldByName( 'FecVcto' ).AsString)) - Date;
iFile := StrToInt(SoloNumeros(Dt1.TInventario.FieldByName( 'AvisoVcto' ).AsString, 0));
// Cambia color a inventario vencido
if ( SoloNumeros( Dt1.TInventario.FieldByName('ActivaVencto').AsString, 0) = '1' ) then begin
if ( Abs( iFile ) >= iDif ) then begin
DBGrid1.Canvas.Brush.Color := $004080FF;
end;
end;
end;
DBGrid1.DefaultDrawColumnCell(Rect, DataCol, Column, State);
end;
Responder Con Cita