【问题标题】:How to delete all items of a TFlowLayout at runtime?如何在运行时删除 TFlowLayout 的所有项目?
【发布时间】:2021-10-01 09:51:36
【问题描述】:

我想在运行时清除 FlowLayout,有什么功能可以做到吗? 我想映射它的所有项目和免费主题,但我不知道如何访问它的项目,请有代码示例吗?

【问题讨论】:

    标签: delphi firemonkey delphi-10.3-rio flowlayout


    【解决方案1】:

    使用ChildrenChildrenCount 属性,您可以以相反的顺序释放项目

    for i := FlowLayout1.ChildrenCount-1 downto 0 do
      FlowLayout1.Children[i].Free;
    

    或按正序(重复寻址索引为 0 的项目)

    for i := 0 to FlowLayout1.ChildrenCount-1 do
      FlowLayout1.Children[0].Free;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-03
      • 2014-09-30
      • 1970-01-01
      • 2021-03-15
      • 2011-07-19
      • 2014-06-09
      相关资源
      最近更新 更多