只是一个Owner的问题,一个让Self(应该是Form吧)作为Owner,一个让Application作为Owner。
Owner可以在自己释放的时候将所有Owner属性设为这个Owner的控件释放,仅此而已。

解决方案 »

  1.   

    假如:
    cpage :=Tpageontrol.create(NIL);
    是可以的,但必须自己手工释放:cpage.Free;
      

  2.   

    谁作Owner在程序运行中有什么不一样吗?
    还有,creat中还有其它的参数吗??请告知。
      

  3.   

    运行中一般没有什么不一样,除了(NIL)的话要自己手工释放。
    create是一个构造函数,控件参数一般就是Owner :TComponent ,一些特殊的类有不同的参数。
    例如:TStringList的Create就没有参数。
      

  4.   

    没什么不一样的,只不过由哪个Owner释放而已
    看一下
    procedure TComponent.DestroyComponents;
    var
      Instance: TComponent;
    begin
      while FComponents <> nil do
      begin
        Instance := FComponents.Last;
        if (csFreeNotification in Instance.FComponentState)
          or (FComponentState * [csDesigning, csInline] = [csDesigning, csInline]) then
          RemoveComponent(Instance)
        else
          Remove(Instance);
        Instance.Destroy;
      end;
    end;
    这是当TComponent的destroy所调用的,而TComponent是所有组件的祖先继承自TComponent的组件都为Create(AOwner: TComponent);
    另外Create的函数也是可以重载的