I have got some of the latest version of the VirtualTreeView and try to
change the background color of the whole row of TVirtualStringTree
both in selected and in non-selected states (toFullRowSelect
is included somewhere). There is a lot of similar questions with different answers but none seems to fit well. In all of them you just write a handler that includes the code snippet like this:
TargetCanvas.Brush.Color := SomeColor;
TargetCanvas.FillRect(SomeRect);
But it's not that simple as I thought:
OnBeforeCellPaint
handler works well only if the row is not
selectedOnDrawText
handler works in both states but the entire
row looks divided by spaces between cellsOnBeforeItemErased
affects the whole row but again if it is not in selected stateSo I failed to find an easy way.
I added the additional conditions:
toMultiSelect
is included).The best I could create is to write a handler on OnDrawTexr
event:
This tree is produced by an array of records (oversimplified):
type
TJob=record
Running:Boolean;// the job is stopped or running
MaxDuration:integer;//0 - infinite, or seconds
Start:TDateTime;//The job start time
end;
Use OnBeforeCellPaint
for non selected row, use Colors.FocusedSelectionColor
property for selected row..