因为并没有指定持有者
Owner 属性为 nil
constructor TComponent.Create(AOwner: TComponent);
begin
FComponentStyle := [csInheritable];
if AOwner <> nil then AOwner.InsertComponent(Self);
end;
with TEdit.Create(nil) do begin
改为
with TEdit.Create(Self) do begin
或者 指定了 Parent
可以通过 Controls 和 ControlCount 来获得