1.循环遍历载体时,动态创建的控件没释放一个
载体的controlcount 则减 1
所以使用以下方法即可:
for i := SB_CreateControls.ControlCount - 1 downto 0 do
begin
if TObject(SB_CreateControls.Controls[i]) is TUniCheckBox then
begin
if Assigned(TUniCheckBox(SB_CreateControls.Controls[i])) then
begin
TUniCheckBox(SB_CreateControls.Controls[i]).Destroy;
end;
end;
end;
SchTimeForm.Close;