[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;
Res: [delphi-br] Re: onDrawDataCell
Valeu pela resposta, Mas no seu caso vc nao esta usando o onDrawColumnCel ? Minha duvida é quanto ao onDrawDataCell . Eu não consegui entender quando o evento é disparado, e nem o que ele faz. - Mensagem original De: alan_adolfo [EMAIL PROTECTED] Para: delphi-br@yahoogrupos.com.br Enviadas: Sexta-feira, 21 de Setembro de 2007 11:58:36 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. grdJogadorDrawCo lumnCell( 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.qryJogadorn 1.Text); n2 := Trim(DM.qryJogadorn 2.Text); n3 := Trim(DM.qryJogadorn 3.Text); n4 := Trim(DM.qryJogadorn 4.Text); n5 := Trim(DM.qryJogadorn 5.Text); n6 := Trim(DM.qryJogadorn 6.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; DefaultDrawColumnCe ll(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; DefaultDrawColumnCe ll(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; DefaultDrawColumnCe ll(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; DefaultDrawColumnCe ll(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; DefaultDrawColumnCe ll(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; DefaultDrawColumnCe ll(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; DefaultDrawColumnCe ll(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; DefaultDrawColumnCe ll(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; DefaultDrawColumnCe ll(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
RES: [delphi-br] Re: onDrawDataCell
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