VirtualTreeView and VCL Styles

i'm using VirtualTreeView (as a grid - in Delphi XE7) in my app and i also chose to use the Carbon VCL style. The problem arise because i need to color some rows according some status on each line, and the font color keep staying white even when i use a light color on a line. So it is impossible to read the data. When i use the Iceberg Classico style, this issue do not occurs.

So basically, i can change my set of rows color according to the style selected, it is one solution. But i'm looking for a way to modify the font color according to the row color background?

I'm doing the colorization code inside the event: BeforeCellPaint and i tried to modify the font color without any success.

Any idea?


i found a library that helps a lot on this subject:

// unit for the VCL Styles Utils 
// github.com/RRUZ/vcl-styles-utils 

TargetCanvas.Brush.Color := aColor; 
if TStyleManager.ActiveStyle.Name = 'Carbon' then
   TCustomStyleExt(TStyleManager.ActiveStyle).SetStyleFontColor(sfTreeItemTextNorma‌​l, clBlack) 
else
   TCustomStyleExt(TStyleManager.ActiveStyle).SetStyleFontColor(sfTreeItemTextNorma‌​l, aFontColor); 
TargetCanvas.FillRect(CellRect); 

With this i can change the font color.

Laurent

链接地址: http://www.djcxy.com/p/87038.html

上一篇: xslt根据背景颜色亮度更改文字

下一篇: VirtualTreeView和VCL样式