Board index » delphi » DBGrid: different color for odd/even record no in dbgrid?

DBGrid: different color for odd/even record no in dbgrid?

i can make DBGrid has different color in each row in paradox,
by using OnDrawDataCell and TDBGrid.RecNo,
when record no is odd, color is clwindow, clred for even.
e.g.
clwindow
clred
clwindow
clred
clwindow
clred
but in interbase, TDBGrid.RecNo is always -1,
any other way to achieve the same thing?
 

Re:DBGrid: different color for odd/even record no in dbgrid?


Most SQL-servers don't support the RecNo.
You can use the grid's rownumber to do the coloring (than you have to hack
the DBGrid-component).
As an alternative you can use a boolean-variable. Set it to false. After
coloring a row set it to the opposit. If MyBoolean then Color := clRed else
Color := clWindow.

As a third : download a component from Torrys or DSP.

Alfred.

"K.I.A." <de...@hell.com> schreef in bericht
news:3A0A7FCF.FC2E956C@hell.com...

Quote
> i can make DBGrid has different color in each row in paradox,
> by using OnDrawDataCell and TDBGrid.RecNo,
> when record no is odd, color is clwindow, clred for even.
> e.g.
> clwindow
> clred
> clwindow
> clred
> clwindow
> clred
> but in interbase, TDBGrid.RecNo is always -1,
> any other way to achieve the same thing?

Re:DBGrid: different color for odd/even record no in dbgrid?


Hello K.I.A.,

Please look at DbAltGrid at http://www.dbaltgrid.com/ . It allows alternate
row coloring. In contrast to other solutions the color of a record remains
the same even by scrolling.

If you would use it with IBExpress, make sure you have installed the last
version of IBX, http://www.borland.com/interbase/downloads/#ibx

--
Kind regards, Andrei Fomine, Quasidata.
DbAltGrid allows multi-line layout and RTF text in a DBGrid descendant.

Quote
"K.I.A." <de...@hell.com> wrote in message

news:3A0A7FCF.FC2E956C@hell.com...
Quote
> i can make DBGrid has different color in each row in paradox,
> by using OnDrawDataCell and TDBGrid.RecNo,
> when record no is odd, color is clwindow, clred for even.
> e.g.
> clwindow
> clred
> clwindow
> clred
> clwindow
> clred
> but in interbase, TDBGrid.RecNo is always -1,
> any other way to achieve the same thing?

Other Threads