I want to change the color of text in a specific row of a virtual string tree. is it possible?
Use the OnBeforeCellPaint event:
procedure TForm1.VirtualStringTree1BeforeCellPaint(Sender: TBaseVirtualTree;
TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex;
CellPaintMode: TVTCellPaintMode; CellRect: TRect; var ContentRect: TRect);
begin
if Node.Index mod 2 = 0 then
begin
TargetCanvas.Brush.Color := clFuchsia;
TargetCanvas.FillRect(CellRect);
end;
end;
This will change the background on every other row (if the rows are on the same level).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With