VirtualStringTree - different text formats in the same multi-line node

I have an instance TVirtualStringTreethat formats node text in two different ways. The implementation is based on using toShowStaticTextin StringOptions, as described in the accepted answer to this question: VirtualTreeView - different text color in the same node

Everything works fine until I set the flag MultiLinefor nodes. Now the event OnPaintTextwill no longer be fired with TextType = ttStatic.

The reason for this behavior can be found in the method TCustomVirtualStringTree.DoPaintNodeand, obviously, it is assumed:

// ... 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;

However, I want to have two different text formats in the same MultiLineNode. How can i do this?

+4

Source: https://habr.com/ru/post/1662315/


All Articles