我有TVirtualStringTree
的实例,它以两种不同的方式格式化节点的文本。该实施基于使用toShowStaticText
中的StringOptions
,如此问题的接受答案中所述:VirtualTreeView - different color of text in the same node
在我为节点设置MultiLine
标志之前,一切都已正常工作。现在OnPaintText
将不再触发TextType = ttStatic
事件。
可以在TCustomVirtualStringTree.DoPaintNode
方法中找到此行为的原因,显然是:
// ... 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;
尽管如此,我希望在同一个MultiLine
节点中有两种不同的文本格式。我怎么能这样做?