Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Change font color in TLMDGrid cells

I'm looking for a way to change font color of a cell (LMD Tools 2017) depending of some cell content. I know how to retrieve cell content, but I don't know how to change the cell's properties like font color, style or the like. I tried to set ACanvas.Font.Color etc. in OnDrawDataCell event, but this doesn't seem to work.

A simple example:

I'm filling a TLMDGrid (no DBGrid!) with values from elsewhere, and I need to color some Field values depending on their content, e.g. negative values being red and positives being green. I currently founf the OnGetCellColor event where I can set the background color of every single cell (AColor), but not the Font.Color. Setting AColumn.Font.Color always colors the entire column rather than the cell.

TIA for any help.


  • 1 Comment sorted by Votes Date Added
  • Hi,

    In a couple of days we will publish minor release in which I've added new OnGetCellColors event (in addition to existing OnGetCellColor), which allows to change both background and font colors.
Sign In or Register to comment.