delphi – FireMoneky中的太多元素的最佳策略TListView项目[复制
参见英文答案 >
Create a customized Item Appearance for ListView Delphi XE71个
相信我,在完成帮助之前,我做了功课.我花了3天时间搜索和阅读,但我无法找到解决方案.所以任何帮助都将受到高度赞赏. 我的任务是将ListView连接到数据集,其中ListView项具有以下结构: 请记住 >元素4,6和& 8具有固定值&颜色(即标签) 我得到的最好的是对Delphi标准示例的引用,该示例随Embarcadero Delphi示例目录移动:ListViewMultiDetailAppearance. 现在我的问题: >这是最好的方法吗? 非常感谢你提前的想法. 解决方法
我不确定我的方式是否正确,但我在我的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事件处理程序内部的逻辑设置所有必要的设置. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |