Board index » delphi » Dbgrid On draw field format problem

Dbgrid On draw field format problem

Now that I m drawing my grid to change  row colors I
lost my default field formats . Example How do I
format my Fields columns to currency !

Thanks Dean

 

Re:Dbgrid On draw field format problem


Quote
DHastas wrote in message <37184CF7.97B55...@adelphia.net>...
>Now that I m drawing my grid to change  row colors I
>lost my default field formats . Example How do I
>format my Fields columns to currency !

You can use the Format function:

  s := Format('%n', [MyCurrencyValue]); // "1,234,567.00"

  s := Format('%m', [MyCurrencyValue]); // "$1,234,567.00"

--
Wayne Niddery - WinWright Consulting
Delphi, C++Builder, JBuilder, InterDev --
http://home.ican.net/~wniddery/RADBooks.html
...remove chaff when replying...
"You know you've landed gear-up when it takes full power to taxi"

Re:Dbgrid On draw field format problem


After you change your canvas or font colors just call
TDBGrid.DefaultDrawColumnCell and the TDBGrid should handle all that for
you.

I have this tip and a few others on the TDBGrid on my Delphi Tip of the Day
webpage at http://members.truepath.com/delphi

--
Lewis Howell
lewishow...@yahoo.com
Lou's Delphi Tip of the Day
http://members.truepath.com/delphi
Lou's Other Web Page
http://members.truepath.com/LewisHowell

Quote
Wayne Niddery (TeamB) wrote in message <7faf3e$n...@forums.borland.com>...
>DHastas wrote in message <37184CF7.97B55...@adelphia.net>...
>>Now that I m drawing my grid to change  row colors I
>>lost my default field formats . Example How do I
>>format my Fields columns to currency !

>You can use the Format function:

>  s := Format('%n', [MyCurrencyValue]); // "1,234,567.00"

>  s := Format('%m', [MyCurrencyValue]); // "$1,234,567.00"

>--
>Wayne Niddery - WinWright Consulting
>Delphi, C++Builder, JBuilder, InterDev --
>http://home.ican.net/~wniddery/RADBooks.html
>...remove chaff when replying...
>"You know you've landed gear-up when it takes full power to taxi"

Re:Dbgrid On draw field format problem


After you change your canvas or font colors just call
TDBGrid.DefaultDrawColumnCell and the TDBGrid should handle all that for
you.

I have this tip and a few others on the TDBGrid on my Delphi Tip of the Day
webpage at http://members.truepath.com/delphi

--
Lewis Howell
lewishow...@yahoo.com
Lou's Delphi Tip of the Day
http://members.truepath.com/delphi
Lou's Other Web Page
http://members.truepath.com/LewisHowell

Quote
DHastas wrote in message <37184CF7.97B55...@adelphia.net>...
>Now that I m drawing my grid to change  row colors I
>lost my default field formats . Example How do I
>format my Fields columns to currency !

>Thanks Dean

Other Threads