delphi – FireMoneky中的太多元素的最佳策略TListView项目[复制]

参见英文答案 > Create a customized Item Appearance for ListView Delphi XE71个
相信我,在完成帮助之前,我做了功课.我花了3天时间搜索和阅读,但我无法找到解决方案.所以任何帮助都将受到高度赞赏.

我的任务是将ListView连接到数据集,其中ListView项具有以下结构:

请记住

>元素4,6和& 8具有固定值&颜色(即标签)
>元素的颜色1& 10取决于元素5,7和&的值. 9

我得到的最好的是对Delphi标准示例的引用,该示例随Embarcadero Delphi示例目录移动:ListViewMultiDetailAppearance.
这个解决方案提供了为MutliDetailItemAppearance创建我们自己的类,并根据需要注册了许多细节(在我的情况下,我认为我需要额外的8个).

现在我的问题:

>这是最好的方法吗?
>如果没有,有什么更好的方法?
>如果是的话,如何添加额外的8个细节会影响到
性能?
>最重要的是如何为元素实现自定义着色
每个列表查看项目基于值?
>最后如何到达这个部分的边界?和列表项目底部
边界(绿线)?

非常感谢你提前的想法.

解决方法

我不确定我的方式是否正确,但我在我的fmx项目中使用TListbox的目的是相同的.在通过LiveBindings从DataSource填充期间,其项目的结构以下列方式形成.
procedure THMICD10Fr.LinkListControlToField1FillingListItem(Sender: TObject;
  const AEditor: IBindListEditorItem);
begin
  if (Assigned(AEditor)) and (HDM2.FDQicd_detail_for_TreeView.Active) then
    try
      if (AEditor.CurrentObject as TMetropolisUIListBoxItem).ChildrenCount = 2
      then
      begin

        with TPanel.Create(AEditor.CurrentObject as TMetropolisUIListBoxItem) do
        begin
          Parent := (AEditor.CurrentObject as TMetropolisUIListBoxItem);
          Align := TAlignLayout.alRight;
          Width := 45;
          Margins.Bottom := 1;
          Margins.Top := 1;
        end;

        with TLabel.Create((AEditor.CurrentObject as TMetropolisUIListBoxItem)
          .Children.Items[2] as TPanel) do
        begin
          Parent := (AEditor.CurrentObject as TMetropolisUIListBoxItem)
            .Children.Items[2] as TPanel;
          Text := '↓';
          VertTextAlign := TTextAlign.taCenter;
          TextAlign := TTextAlign.taCenter;
          Align := TAlignLayout.alClient;
          HitTest := true;
          AutoSize := false;
          StyledSettings := StyledSettings - [TStyledSetting.ssStyle];
          Font.Style := Font.Style + [TFontStyle.fsBold];
          Tag := HDM2.FDQicd_detail_for_TreeView.FieldByName('id').AsInteger;
          TagString := HDM2.FDQicd_detail_for_TreeView.FieldByName
            ('category_etiology').AsString;
          OnClick := LabelInListBox1Click;
        end;
      end;

    except

    end;
end;

这段代码给了我以下外观:

您可以在Item中创建并嵌套所有必需的TLayouts,TLabels等,并使用LiveBindings事件处理程序内部的逻辑设置所有必要的设置.

相关文章

 从网上看到《Delphi API HOOK完全说明》这篇文章,基本上都...
  从网上看到《Delphi API HOOK完全说明》这篇文章,基本上...
ffmpeg 是一套强大的开源的多媒体库 一般都是用 c/c+&#x...
32位CPU所含有的寄存器有:4个数据寄存器(EAX、EBX、ECX和ED...
1 mov dst, src dst是目的操作数,src是源操作数,指令实现的...