Você sabe fazer pra mudar uma coluna toda? Por exemplo, quando se clicar no
titulo do grid para ordenar, mudar o fundo das células da coluna toda.
[]s
Topolniak
De: delphi-br@yahoogrupos.com.br [mailto:[EMAIL PROTECTED] Em
nome de alan_adolfo
Enviada em: sexta-feira, 21 de setembro de 2007 10:59
Para: delphi-br@yahoogrupos.com.br
Assunto: [delphi-br] Re: onDrawDataCell
Ola , vamos ver se eu tiro a sua duvia
onDrawDataCell ele muda a cor do campos do Grid, por exemple
tenho uma tabela q contem 6 campo da mega sena, e tenho um cadastr
de 29 jogos e gostaria de rachurar os numeros q saiu na ultima
megasena.
Olha como eu fiz.
Bom não sei se eu te ajudei a exclarecer sua duvida, me manda
resposta para eu saber se ja entendeu.
procedure TfrmJogoDaSena.grdJogadorDrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
Var
nOldB, nOldF : TColor;
// contA : integer;
Begin
With grdJogador Do
Begin
n1 := Trim(DM.qryJogadorn1.Text);
n2 := Trim(DM.qryJogadorn2.Text);
n3 := Trim(DM.qryJogadorn3.Text);
n4 := Trim(DM.qryJogadorn4.Text);
n5 := Trim(DM.qryJogadorn5.Text);
n6 := Trim(DM.qryJogadorn6.Text);
nOldF := Canvas.Font.Color;
nOldB := Canvas.Brush.Color;
a := trim(edtN1.Text);
b := trim(edtN2.text);
c := trim(edtN3.text);
d := trim(edtN4.text);
e := trim(edtN5.text);
f := trim(edtN6.text);
If (Column.Index = 1) and Not (gdFocused in State) Then
Begin
If n1 = (a) Then
Begin
Canvas.Brush.Color := clInfoBk;
Canvas.Font.Color := nOldF;
contadora;
End;
If (gdFocused in State) Then
Canvas.Font.Color := clWhite;
DefaultDrawColumnCell(Rect, Datacol, Column, State);
End;
If (Column.Index = 2) and Not (gdFocused in State) Then
Begin
If n2 = (a) Then
Begin
Canvas.Brush.Color := clInfoBk;
Canvas.Font.Color := nOldF;
contadora;
End;
If (gdFocused in State) Then
Canvas.Font.Color := clWhite;
DefaultDrawColumnCell(Rect, Datacol, Column, State);
End;
If (Column.Index = 3) and Not (gdFocused in State) Then
Begin
If n3 = (a) Then
Begin
Canvas.Brush.Color := clInfoBk;
Canvas.Font.Color := nOldF;
contadora;
End;
If (gdFocused in State) Then
Canvas.Font.Color := clWhite;
DefaultDrawColumnCell(Rect, Datacol, Column, State);
End;
If (Column.Index = 4) and Not (gdFocused in State) Then
Begin
If n4 = (a) Then
Begin
Canvas.Brush.Color := clInfoBk;
Canvas.Font.Color := nOldF;
contadora;
End;
If (gdFocused in State) Then
Canvas.Font.Color := clWhite;
DefaultDrawColumnCell(Rect, Datacol, Column, State);
End;
If (Column.Index = 5) and Not (gdFocused in State) Then
Begin
If n5 = (a) Then
Begin
Canvas.Brush.Color := clInfoBk;
Canvas.Font.Color := nOldF;
contadora;
End;
If (gdFocused in State) Then
Canvas.Font.Color := clWhite;
DefaultDrawColumnCell(Rect, Datacol, Column, State);
End;
If (Column.Index = 6) and Not (gdFocused in State) Then
Begin
If n6 = (a) Then
Begin
Canvas.Brush.Color := clInfoBk;
Canvas.Font.Color := nOldF;
contadora;
End;
If (gdFocused in State) Then
Canvas.Font.Color := clWhite;
DefaultDrawColumnCell(Rect, Datacol, Column, State);
End;
//
If (Column.Index = 1) and Not (gdFocused in State) Then
Begin
If n1 = (b) Then
Begin
Canvas.Brush.Color := clInfoBk;
Canvas.Font.Color := nOldF;
contadorb;
End;
If (gdFocused in State) Then
Canvas.Font.Color := clWhite;
DefaultDrawColumnCell(Rect, Datacol, Column, State);
End;
If (Column.Index = 2) and Not (gdFocused in State) Then
Begin
If n2 = (b) Then
Begin
Canvas.Brush.Color := clInfoBk;
Canvas.Font.Color := nOldF;
contadorb;
End;
If (gdFocused in State) Then
Canvas.Font.Color := clWhite;
DefaultDrawColumnCell(Rect, Datacol, Column, State);
End;
If (Column.Index = 3) and Not (gdFocused in State) Then
Begin
If n3 = (b) Then
Begin
Canvas.Brush.Color := clInfoBk;
Canvas.Font.Color := nOldF;
contadorb;
End;
If (gdFocused in State) Then
Canvas.Font.Color := clWhite;
DefaultDrawColumnCell(Rect, Datacol, Column, State);
End;
If (Column.Index = 4) and Not (gdFocused in State) Then
Begin
If n4 = (b) Then
Begin
Canvas.Brush.Color := clInfoBk;
Canvas.Font.Color := nOldF;
contadorb;
End;
If (gdFocused in State) Then
Canvas.Font.Color := clWhite;
DefaultDrawColumnCell(Rect, Datacol, Column, State);
End;
If (Column.Index = 5) and Not (gdFocused in State) Then
Begin
If n5 = (b) Then
Begin
Canvas.Brush.Color := clInfoBk;
Canvas.Font.Color := nOldF;
contadorb;
End;
If (gdFocused in State) Then
Canvas.Font.Color := clWhite;
DefaultDrawColumnCell(Rect, Datacol, Column, State);
End;
If (Column.Index = 6) and Not (gdFocused in State) Then
Begin
If n6 =(b) Then
Begin
Canvas.Brush.Color := clInfoBk;
Canvas.Font.Color := nOldF;
contadorb;
End;
If (gdFocused in State) Then
Canvas.Font.Color := clWhite;
DefaultDrawColumnCell(Rect, Datacol, Column, State);
End;
//
If (Column.Index = 1) and Not (gdFocused in State) Then
Begin
If n1 = (c) Then
Begin
Canvas.Brush.Color := clInfoBk;
Canvas.Font.Color := nOldF;
contadorc;
End;
If (gdFocused in State) Then
Canvas.Font.Color := clWhite;