TTreeView-折叠和展开未分配的图像

问题描述 投票:0回答:1

有人知道我如何将折叠/展开图像与图标中心对齐吗?使用白色主题是正确的,但在深色主题中,箭头似乎是底部对齐:

Image of arrows not aligned

delphi treeview
1个回答
0
投票

如果使用VCL样式Utils组件,则在Vcl.Styles.UxTheme.pas中修改UxTheme_TreeView

  case iPartId of
    TVP_GLYPH:
      begin
        LColor := StyleServices.GetSystemColor(clWindowText);
        LRect := pRect;
        LRect.Top := LRect.Top + 1; // <---- here's the change
        //LRect.Top := LRect.Top + 5;
        LRect.Left := LRect.Left + 5;

        if (iStateId = GLPS_OPENED) or (iStateId = HGLPS_OPENED) then
          DrawStyleArrow(hdc, TScrollDirection.sdDown, LRect.Location, 3, LColor)
        else
          DrawStyleArrow(hdc, TScrollDirection.sdRight, LRect.Location, 3, LColor);

        exit(S_OK);
      end;

也设置树视图属性ShowLines := false;

© www.soinside.com 2019 - 2024. All rights reserved.