Fórum Grid Zebrado... #320589
04/05/2006
0
procedure TForm3.RxDBGrid1DrawColumnCell(Sender: TObject;const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
Var
A:Talignment; //Guarda a Formatação da Coluna
begin
a:=rxdbGrid1.columns[DataCOL].Alignment; //Pegando a formatação da Coluna
if not odd(ADOQuery1.RecNo) then //Testando se é par
begin
RXDBGrid1.Canvas.Brush.Color:= clMoneyGreen; //Atribui cor
RXDBGrid1.Fields[datacol].Alignment:=a; //Atribui formatação
RXDBGrid1.Canvas.FillRect(Rect);
RXDBGrid1.DefaultDrawDataCell(Rect, Column.Field, State); //Pinta a Célula
if gdFocused in State then //testa se está selecionado
begin
RXDBGrid1.Canvas.Brush.Color:= clBlack;
RXDBGrid1.Canvas.FillRect(Rect);
RXDBGrid1.DefaultDrawDataCell(Rect, Column.Field, State);
end;
end;
end;
Cabal
Curtir tópico
+ 0Posts
04/05/2006
Ricardo_ascii
Eu faço dessa forma e vai normal. Dê uma olhada e vê se ajuda.
Coloca no evento do DrawColumnCell do dbgrid.
if not odd(tabela.RecNo) then
begin
if not (gdSelected in state) then
begin
dbGrid1.Canvas.Brush.Color := $00FFF8F0;
dbGrid1.Canvas.FillRect(Rect);
dbGrid1.DefaultDrawDataCell(rect,column.field,state);
end;
end;
espero ter ajudado
Gostei + 0
04/05/2006
Cabal
Gostei + 0
04/05/2006
Ricardo_ascii
Vc. tem que ir la no componente table e colocar ´tacenter´ no campo correspondente.
Abraço, Ricardo
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)