Delphi TreeView: Can I have different styles in one node's text?
I want to show a string like this as a note's text:
Name: 开发者_如何转开发John
It has a bold part and a regular one. Is there a way that I can do this?
Yes, using custom drawing (OnCustomDraw
, OnCustomDrawItem
events). Have a look at the CustomDraw demo that comes with Delphi. It demonstrates a custom-drawn treeview.
You can use custom draw, yes, but this is not always handy. I can recommend looking at LMD ElPack (), namely their ElTree class. That class lets you use mini-HTML in nodes and optionally in secondary cells (ElTree is a TreeList control).
You have to use owner-drawing. Have a look at the On*CustomDraw*
events.
精彩评论