//双重保险,TImage对象有时候使用FindControl时候释放不掉 而其他类型的控件时可以的。
    self.ScrollBox1.FindComponent(global.ItemIDList.Strings[i]).Free;
    (self.ScrollBox1 as TScrollBox).FindChildControl(global.ItemIDList.Strings[i]).Free;

以上代码无法删掉动态创建的TImage对象,双重保险也不管用。

 

//真正起作用的是下面的代码  上面的完全失效 释放不掉
with (self.ScrollBox1 as TScrollBox) do
begin
    for i:=ControlCount-1 downto 0 do
     if (uppercase(Controls[i].Name)<>uppercase('BackgroundImage')) and (uppercase(Controls[i].ClassName)=uppercase('TImage')) then
           Controls[i].Free;

end;

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-13
  • 2021-11-22
  • 2021-06-05
  • 2021-05-25
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案