Custom font and cell background colors for a selected row

My TAdvStringGrid and TDBAdvGrid's make use of the OnGetCellColor to successfully colorize the font color, and sometimes the background color, of each cell. I have my grids configured to show the entire row selection, rather than individual cells. So, when a row is selected, all of the row's cells are displayed in the characteristic black text over the configured SelectionColor ($00D1B9A5, by default).

Ideally, I would like to retain the same font colors that are displayed in un-selected rows as well as show the background in a lighter color ($00D1B9A5 would be too dark to distinguish the red, green, gray fonts that are used in some column values).

Is there a way to disable the generic one-font-color-over-one-background-color in a selected row? Perhaps it has to be done in the OnGetCellColor event which passes in the AState variable? I've tried, but can't get it to work.

Is there a OnGetSelectedCellColor, or something equivalent?

Thanks,

Seve

Using grid.UseSelectionTextColor = false should allow this.

Excellent! Sorry for not seeing that property myself. :)

So, this handles the font color, but the default SelectionColor is still used. Is it possible to override that for specific columns? Ideally, I would like the assigned ABrush color in the OnGetCellColor event for a specific ACol to be used. For example, I tried "if (gdSelected in AState) and (ACol=4) then ABrush.Color := clYellow", but that didn't work. It's not allowing me to override the default selection color.

Perhaps this isn't possible ... let me know.

Steve

When you set grid.SelectionColorMixer = true, you can control the % of use of SelectionColor with the property grid.SelectionColorMixerFactor

Perfect!!!! (as before, sorry for not seeing this on my own.)

On a side note, there's another unused variable warning from the latest update I just installed. Picture attached.

I assume you are not using the latest version of the TMS VCL UI Pack as this was already addressed.