请教各位,比如在form1中有个controlpanel控件,我想让form2在form1中实例化并且要显示在controlPanel中,该怎么写?

解决方案 »

  1.   

    procedure TForm1.Button1Click(Sender: TObject);
    begin
      TForm2.Create(self);
      Form2.Parent:=controlpanel;
      Form2.Show;
    end;
      

  2.   

    好象不行,窗口还是显示在外面,没进到pageControl里面!
      

  3.   

    procedure TForm1.Button1Click(Sender: TObject);
    begin
      TForm2.Create(self);
      Form2.Parent:=controlpanel;
      Form2.Show;
    end;
      

  4.   

    procedure TForm1.Button1Click(Sender: TObject);
    begin
      Form2 := TForm2.Create(self);
      //Form2.Parent:=controlpanel;
      Windows.SetParent(Form2.Handle, controlpanel.Handle);
      Form2.Show;
    end;
      

  5.   

    不会弹出呀,把Form2的BorderStyle设为bsNone,用下面代码
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      TForm2.Create(self);
      Form2.Parent:=panel1;
      Form2.Left:=0;
      Form2.Top:=0;
      Form2.Show;
    end;
    Form2就可以在Panel1里面显示出来,而不会弹出呀...