5

I have an instance of TVirtualStringTree that formats text of a node in two different ways. The implementation is based on using toShowStaticText in the StringOptions as described in the accepted answer of this question: VirtualTreeView - different color of text in the same node

Everything used to work fine until I've set the MultiLine flag for the nodes. Now the OnPaintText event will no longer be triggered having TextType = ttStatic.

The reason for this behaviour can be found in the TCustomVirtualStringTree.DoPaintNode method and is obviously intended:

// ... and afterwards the static text if not centered and the node is not multiline enabled.
if (Alignment <> taCenter) and not (vsMultiline in PaintInfo.Node.States) and (toShowStaticText in TreeOptions.FStringOptions) then
begin
  S := '';
  with PaintInfo do
    DoGetText(Node, Column, ttStatic, S);
  if Length(S) > 0 then
    PaintStaticText(PaintInfo, TextOutFlags, S);
end;

Nevertheless, I want to have two different text formats in the same MultiLine Node. How can I do that?

Community
  • 1
  • 1
Wosi
  • 41,986
  • 17
  • 75
  • 82

0 Answers0