加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

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

发布时间:2020-12-15 10:11:17 所属栏目:大数据 来源:网络整理
导读:当我在TVirtualStringTree.PaintOptions中使用toUseExplorerTheme时,它会像这样绘制选择: 请注意,选择从控件的左侧延伸到任何节点标题的最右侧范围的位置;选择的宽度都相同. 我希望它看起来像这个图像(someone else’s project,使用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的合作!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读