DELPHI: cxGrid Zebrar linhas e pintar linha selecionada

0

Posted on : 26-10-2012 | By : Paulo H Oliveira | In : Delphi

Segue abaixo uma dica de como zebrar as linhas no cxGrid e pintar a linha selecionada:

procedure TForm1.cxGrid1DBTableView1CustomDrawCell(
  Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
  AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
begin
  if AViewInfo.GridRecord.Selected then
  begin
    ACanvas.Brush.Color       := clAqua;
    ACanvas.Canvas.Font.Color := clBlack;
    ACanvas.Canvas.Font.Style :=[fsBold];
  end
  else
  begin
    if AViewInfo.GridRecord.RecordIndex mod 2 = 0 then
      ACanvas.Brush.Color := clWindow
    else
      ACanvas.Brush.Color := clSkyBlue;
  end;
end;

Compartilhe :

  • Stumble upon
  • twitter

Escreva um comentário

Security Code: