Board index » cppbuilder » Text color changes in String Grid

Text color changes in String Grid

Hi,
    I am currently using a scring grid component in Builder C++
professional, Version 3. I have sized the cells to equal the width and
height of one character.
I would like to be able to change the color of the font character in each
cell individually and maintain this color throughout the edit process of
entering and changing the character in the cell. I have been able to change
the color of the font but I have not been able to display the font in the
new color within the cell. It seems the grid will change the font to any
color as long as it is black! How do you change the font color in a string
grid cell? (Foreground color)
S...@Telegenix.Com
 

Re:Text color changes in String Grid


Hi Sydney,
[snip]

Quote
> How do you change the font color in a string grid cell? (Foreground color)

From the Mini FAQ a few posts earlier...

(Q4.3)  How do I change the font/background color of a particular cell
        in a TStringGrid?

(A4.3)  Set the DefaultDrawing property to false, then implement a
        handler for the OnDrawCell event.  See the following reference
        for a code example:

http://bcbcaq.freeservers.com/sg_color.html

Good luck!

--
Damon Chandler (TeamB)
http://bcbcaq.freeservers.com

Re:Text color changes in String Grid


You have to set DefaultDrawing to false and then use the OnDrawCell event to
handle the actual drawing of each cell yourself.

Wouldn't it just be easier for you to use a TRichEdit instead?

Gambit

Quote
"Sydney Nasife" <S...@Telegenix.com> wrote in message news:38fb5050@dnews...
> I would like to be able to change the color of the font character in each
> cell individually and maintain this color throughout the edit process of
> entering and changing the character in the cell.

Other Threads