gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 14:53:25 24 4
gpt4 key购买 nike

当我在 TVirtualStringTree.PaintOptions 中使用 toUseExplorerTheme 时,它会像这样绘制选择:

Illustration of selection with toUseExplorerTheme

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

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

enter image description here

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

这同样适用于下一个嵌套过程DrawThemedFocusRect。该修复现已提交至 revision r587 ,所以请更新您的虚拟 TreeView 。感谢@joachim合作!

关于delphi - 使用 toUseExplorerTheme 的虚拟 TreeView 选择宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20637534/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com