我正在尝试检查组件是否是类型TMachine
,或者TLabel
如果是,我希望它释放它,只要它不是 Label1 或 label2
但它不会让我做OR
任何if Components[I] is (TMachine) or (TLabel) then
方法来解决这个问题?
procedure TfDeptLayout.FormClose(Sender: TObject; var Action: TCloseAction);
var
I: Integer;
begin
for I := ComponentCount -1 downto 0 do
begin
if Components[I] is (TMachine) or (TLabel) then
if Components[I].Name <> Label2.Name then
if Components[I].Name <> label3.Name then
components[I].Free;
end;
end;