var
 b:tbutton;
begin
 b:=tbutton.create;
 b.parent:=self;//<-------关键一句!
 ......
end;

解决方案 »

  1.   

    var 
      Button: TButton;
    begin
      button := TButton.Create(self);
      with button do
      begin
        Parent := self;
        top := 12;
        ......
      end;
    end;三少 :o)
      

  2.   

     你们在代码都不错但我用TLABEL类时且没有显示,不知是何故??
      

  3.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
      Lbl: TLabel;
    begin
      Lbl := TLabel.Create(Self);
      with Lbl do
      begin
        Parent := Self;
        AutoSize := True;
        Top := 10;
        Left := 10;
        Caption := '干掉日本鬼子';
      end;
    end;Try it
    Good luck三少 :o)
      

  4.   

      thanks!!
      马上给分,记得下次再关照.