Quote Originally Posted by dilettante View Post
Keep in mind that this sort of use of color is strongly discouraged by the Windows Development Guidelines for good reason.


System colors are user controlled, often through accessibility options for low-vision users.

If you do something whizzy like color a cell yellow (or even explicitly white) then what happens if the system Window Text color turns out to be yellow, white, or another pale color?

The user won't be able to read the text, that's what.

And in many countries this can open you to a lawsuit over impaired accessibility.


Just don't do this. Even if you carefully set both background and foreground colors you can be in violation of the laws by overriding the user's accessibility settings.
I agree 100%.

I Add: use with caution, because if you use formula to calculate something (totals, averages, ...) on LeaveCell/EnterCell events, then each time you change Row/Col events will be fired.
Because on flexgrid doesn't exists a method like SetBackColor(x,y) or SetForeColor(x,y), therefore (as SamOscarBrows shows to you) you need each time change Row adn Col property.

If so, set Redraw to False before, and set to True after changing color.
Eventually, see also se FillStyle property for apply color to a range of cells.