Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   OOP (https://www.clubdelphi.com/foros/forumdisplay.php?f=5)
-   -   Como pintar la fila de un DBGrid (https://www.clubdelphi.com/foros/showthread.php?t=31330)

Gustavo Gowdak 04-05-2006 20:48:14

Como pintar la fila de un DBGrid
 
Hola amigos, tengo un DBGrid donde muestros los datos de mis facturas y quiero saber como puedo hacer para que las facturas que no han sido pagadas el fondo de la fila me lo pinte de rojo u otro color y el resto me mantenga el color de original.

droguerman 04-05-2006 20:52:56

revisa este ejemplo, lo aplicas en el evento DrawColumnCell

Código Delphi [-]procedure TfmAlmacen.dbgDetalleDrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); var i : integer; begin with dbgDetalle, dbgDetalle.DataSource.DataSet do begin if fieldByName('nroRevision').AsInteger=0 then Canvas.Brush.Color := clWindow else Canvas.Brush.Color := clRed; Canvas.Font := Column.Font; Canvas.Font.Color := Column.Font.Color; Canvas.Font.Style := Column.Font.Style; SetBkMode(Canvas.Handle, TRANSPARENT); Canvas.FillRect(Rect); case Column.Alignment of taRightJustify : begin SetTextAlign(Canvas.Handle, TA_RIGHT); I := Rect.Right - 2; end; taLeftJustify : begin SetTextAlign(Canvas.Handle, TA_LEFT); I := Rect.Left + 2; end; else begin SetTextAlign(Canvas.Handle, TA_CENTER); I := (Rect.Right + Rect.Left) DIV 2; end; end; { case } Canvas.TextRect(Rect, I, Rect.Top + 2, VarToStr(Column.Field.Value) ); end; end;

vtdeleon 04-05-2006 21:34:04

Saludos

En esta mismi hilo, abajo, hay enlaces que te pueden ayudar. Dale pa'bajo a esta pagina.


La franja horaria es GMT +2. Ahora son las 10:48:14.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi