Link to home
Start Free TrialLog in
Avatar of qas
qas

asked on

Format StringGrid

Hello guys!

How do I format each unique row of a StringGrid ?

Example: how can I alternate white and gray rows in a list put in a StringGrid (five rows: white, gray, white, gray, white) ?

Also, how can I NOT get the selected blue highlight when I click on the grid ?

At last, how can I align a single cell ?

Thanks!
Avatar of Kelmi
Kelmi

You can use TStringGrid's OnDrawCell event. Look Delphi Help to get a pretty good example.
Avatar of qas

ASKER

well...
I managed to code something near OK with Canvas.FillRect(Rect) stuff but there is a little problem:  I can't put text in there since it paints the whole cell...

any help ?
Thanks
Avatar of qas

ASKER

Let me get you some more precisions...

I want to paint the background of some cells but be able to put some text in it.

Thanks again
ASKER CERTIFIED SOLUTION
Avatar of SteveWaite
SteveWaite

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Why not use the TStringAlignGrid component available free from www.hoerstemeier.com - it allows all of what you have asked and an awful lot more.

Adam
Avatar of qas

ASKER

Thanks Steve! Worked fine!
Great! I thought that may help you to suss it out!
Best Wishes,
Steve