I am overriding OnDrawCell for a string grid. In certain circumstance, I want to use the normal TColor that is used for the selected row when the system does the drawing (no OnDrawCell).
Which colo(u)r is that? clXXX ?
I am overriding OnDrawCell for a string grid. In certain circumstance, I want to use the normal TColor that is used for the selected row when the system does the drawing (no OnDrawCell).
Which colo(u)r is that? clXXX ?
Copyright © 2021 Jogjafile Inc.
Before of Delphi 2010 you can use the
clHighlightcolor.In Delphi 2010 the TStringGrid, TDrawGrid and TDBGrid components now have a
DrawingStyleproperty and depending of this value (gdsClassic, gdsGradient, gdsThemed) you must calculate the color on this way.1.for gdsClassic use
clHighlight;2.for gdsGradient use the
GradientFillCanvasmethod3.for gdsThemed call the
DrawElementmethod of theTCustomStyleServicesIn Delphi XE2 (and XE3) with the introduction of the vcl styles you must use the same of the above but checking if the current style is a "custom style" (vcl style)
1.for gdsGradient use the GradientFillCanvas method calculating the colors of the gradient on this way
2.for gdsClassic
If you want check a sample of how the VCL draw a selected (highlighted) cell/row try the implementation of the
TCustomGrid.DrawCellHighlightmethod.