使用toUseExplorerTheme的虚拟TreeView选择宽度

 林志岳小行克元 发布于 2023-02-09 19:21

当我使用toUseExplorerThemeTVirtualStringTree.PaintOptions它绘制这样的选择:

选择的例证与toUseExplorerTheme

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

我希望它看起来像这个图像(其他人的项目,使用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];

TLama.. 6

对不起,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, PaintInfo.Canvas.Handle, TVP_TREEITEM, State, RowRect, nil);
end;

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

1 个回答
  • 对不起,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, PaintInfo.Canvas.Handle, TVP_TREEITEM, State, RowRect, nil);
    end;
    

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

    2023-02-09 19:23 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有