如何使用TVirtualStringTree显示多行项目和“展开”选择项目?
我正在寻找类似于下图的外观(我知道这是使用 TVirtualStringTree 完成的),但我还没有找到任何有关如何完成此操作的示例代码。
任何人都知道我如何可以拥有多行项目(如下面的示例所示),并“展开”选择项目以显示更多行?
I'm looking to create a look similar to the image below (which I know was done using TVirtualStringTree), but I haven't found any example code on how to accomplish this.
Anyone knows how I can have multi-line items like on the example below, and "expand" the select item to show more lines?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请看一下 VT Demos\Advenced。在那里你有一个多行节点演示,我想这可能就是你正在寻找的东西。
可以在此处找到
演示编辑: 下载页面在这里,第三项是演示。
Please take a look at VT Demos\Advenced. In there you have a Multiline nodes demo which I guess might be the thing you are looking for.
Demos can be found here
Edit: The download page is here and the third item is the demos.
我想你已经有了答案,但我会给你一些将其付诸实践的提示,因为这对我来说有点不稳定。 (至少在 Delphi 7 中)
如果您为新行执行 #13#10,请确保 #10 之后有一个空格,否则您将不会得到换行符。
VirtualTree.MultiLine[node] := true 将允许多行,但不一定使其成为多行。
更改标题后,先执行 VirtualTree.InvalidateNode(Node),然后执行 VirtualTree.Refresh 树,以获取节点的新大小。
I guess you've got an answer, but I'll give you a couple hints for putting this into practice because it's been a little wonky for me. (At least in Delphi 7)
If you do a #13#10 for a new line make sure you've got a space after the the #10, otherwise you will not get a line break.
VirtualTree.MultiLine[node] := true will allow multi line, but not necessarily make it multiline.
Do VirtualTree.InvalidateNode(Node) then VirtualTree.Refresh the tree to get the new size for the node after you've changed the caption.