delphi – 使用toUseExplorerTheme的虚拟TreeView选择宽度

delphi – 使用toUseExplorerTheme的虚拟TreeView选择宽度,第1张

概述当我在TVirtualStringTree.PaintOptions中使用toUseExplorerTheme时,它会像这样绘制选择: 请注意,选择从控件的左侧延伸到任何节点标题的最右侧范围的位置;选择的宽度都相同. 我希望它看起来像这个图像(someone else’s project,使用Virtual TreeView),其中选择仅涵盖节点标题的文本: 除非Virtual TreeView中 当我在TVirtualStringTree.Paintoptions中使用toUseExplorertheme时,它会像这样绘制选择:

请注意,选择从控件的左侧延伸到任何节点标题的最右侧范围的位置;选择的宽度都相同.

我希望它看起来像这个图像(someone else’s project,使用Virtual TreeVIEw),其中选择仅涵盖节点标题的文本:

除非Virtual TreeVIEw中有回归(我使用5.2.2),否则这一定是可能的,但我找不到合适的选项组合.

这是我的设置代码:

fTree := TVirtualStringTree.Create(Self);fTree.Parent            := Self;fTree.Align             := alClIEnt;fTree.OnGetText         := TreeGetText;fTree.OnInitNode        := TreeInitNode;fTree.OnInitChildren    := TreeInitChildren;fTree.OnChange          := TreeSelectionChange;fTree.RootNodeCount     := 1;fTree.DrawSelectionMode := smBlendedRectangle;fTree.TreeOptions.Paintoptions     := fTree.TreeOptions.Paintoptions                                      + [toUseExplorertheme];fTree.TreeOptions.Selectionoptions := fTree.TreeOptions.Selectionoptions                                      + [toMultiSelect];
解决方法 对不起,that was my fault.我在 this issue建议的陈述应该是:
procedure DrawBackground(State: Integer);begin  // if the full row selection is Disabled or toGrIDExtensions is in the Miscoptions,draw the selection  // into the InnerRect,otherwise into the RowRect  if not (toFullRowSelect in FOptions.FSelectionoptions) or (toGrIDExtensions in FOptions.FMiscoptions) then    DrawthemeBackground(theme,PaintInfo.Canvas.Handle,TVP_TREEITEM,State,InnerRect,nil)  else    DrawthemeBackground(theme,RowRect,nil);end;

这同样适用于下一个嵌套过程DrawthemedFocusRect.修复程序现在已提交到revision r587,因此请更新您的虚拟树视图.感谢@joachim的合作!

总结

以上是内存溢出为你收集整理的delphi – 使用toUseExplorerTheme的虚拟TreeView选择宽度全部内容,希望文章能够帮你解决delphi – 使用toUseExplorerTheme的虚拟TreeView选择宽度所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/1279227.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-09
下一篇 2022-06-09

发表评论

登录后才能评论

评论列表(0条)

保存