Ver Mensaje Individual
  #2  
Antiguo 21-08-2015
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola wilcg.

Como creo haberte comentado no he usado el componente DBGridEh, pero te pongo un ejemplo con un TDBGrid haciendo el efecto de colores y formato, que creo es el que buscas. Tal vez puedas sacar alguna utilidad del código.
Código Delphi [-]
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
  DataCol: Integer; Column: TColumn; State: TGridDrawState);
const
  CELCOL: array[Boolean] of TColor = ($00F5F5F5, $00606060);
var
  R      : TRect;
  uFormat: LongWord;
  G      : TDBGrid;
  currFld: string;
begin
  G := TDBGrid(Sender);
  R := Rect;
  uFormat := DT_SINGLELINE or DT_VCENTER or DT_END_ELLIPSIS;

  case Column.Alignment of
    taLeftJustify : uFormat := uFormat or DT_LEFT;
    taRightJustify: uFormat := uFormat or DT_RIGHT;
    taCenter      : uFormat := uFormat or DT_CENTER;
  end;

  G.Canvas.Brush.Color := CELCOL[Odd(G.DataSource.DataSet.RecNo)];
  G.Canvas.FillRect(Rect);

  if gdSelected in State then
  begin
    G.Canvas.Brush.Color := $00A6E8FF;
    G.Canvas.Font.Color  := clHotLight;
    G.Canvas.Font.Name   := 'Tahoma';
    G.Canvas.Font.Size   := 9;
  end;

  currFld := Column.Field.AsString;
  if Column.Field.DataType in [ftFloat, ftCurrency, ftBCD] then
    currFld:= FormatFloat('S/. 0.00', Column.Field.Value);

  DrawText(G.Canvas.Handle, PChar(currFld), -1, R, uFormat);
end;

Salida:


Saludos
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....
Responder Con Cita