请问怎么把一个做好的Form(已经实现许多功能)放到另一个Form(这个作为主窗体)上???
之前也看到过类似的问题,请问具体怎么实现?谢谢!

解决方案 »

  1.   

    晕,你最好把问题在说具体些啊,什么一个FORM放到另外一个FORM上?是动态创建窗体吗?是在一个工程里面的窗体吗?
    子窗体不是在主窗体上面吗?
      

  2.   

    请问怎么把一个做好的Form(已经实现许多功能)放到另一个Form(这个作为主窗体)上??? 我觉得挺清楚了呀,前一个form是工程里有的,后一个是作为mainform。
    就类似于把一个button放到form上一样。
      

  3.   

    请问怎么把一个做好的Form2(已经实现许多功能)放到另一个Form1(这个作为主窗体)上???
    我的意思是把Form2嵌入到Form1中,像控件一样?
    你说的是用MDI吗?但是不是我想要的效果,实现不了我的后续功能。
      

  4.   

    我做了一个,可以放上去,但总感觉有点不太完美。
    xmfam能否写 详细一点???
      

  5.   

      Form2.Parent:= Form1;
      Form2.Align:=alClient;
      Form2.BorderStyle:=bsNone;
      Form2.Show;

      Form2:= TForm2.Create(Form1);
      Form2.Parent:= Form1;
      Form2.Align:=alClient;
      Form2.BorderStyle:=bsNone;
      Form2.Show;
      

  6.   

    如果我想在Form1显示Form2,而中有一个button,当点击button时,弹出Form3,且在Form3中也能够显示Form2,请问这个怎么实现。
    我写了一个,但是只能在Form1中显示Form2,而不能在Form3中显示Form2,请问问题出在哪儿?
    代码如下:
    <unit1>
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, unit2, ComCtrls, ToolWin;type
      TForm1 = class(TForm)
        ToolBar1: TToolBar;
        ToolButton1: TToolButton;
        ToolButton2: TToolButton;
        procedure FormShow(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;
      frm:TForm;implementation{$R *.dfm}procedure TForm1.FormShow(Sender: TObject);
    begin
            frm:=TForm2.Create(form1);
            frm.Parent:=form1;
            frm.BorderStyle:=bsNone;   
            frm.Align:=alClient;
            frm.Color:=clred;   
            frm.Show;
    end;<unit2>
    unit Unit2;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm2 = class(TForm)
        Label1: TLabel;
        Memo1: TMemo;
        Edit1: TEdit;
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form2: TForm2;implementation
    uses Unit1, Unit3;
    {$R *.dfm}procedure TForm2.Button1Click(Sender: TObject);
    var fm3:TForm3;
    begin
       fm3:=tform3.Create(self);
       fm3.Show;
    end;end.
    <unit3>
    unit Unit3;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, unit2, ComCtrls, ToolWin;type
      TForm3 = class(TForm)
        procedure FormShow(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form3: TForm3;
      frm:TForm;implementationuses Unit1;{$R *.dfm}procedure TForm3.FormShow(Sender: TObject);
    begin
            frm:=TForm2.Create(form3);
            frm.Parent:=form3;
            frm.BorderStyle:=bsNone;
            frm.Align:=alClient;
            frm.Color:=clred;
            frm.Show;
    end;end.
     
      

  7.   

    谢谢楼上的,frame实现过程是容易些,但是好象Form的一些功能用frame不能实现。
      

  8.   

    procedure   TForm2.Button1Click(Sender:   TObject); 
    var   fm3:TForm3; 
    begin 
          fm3:=tform3.Create(self); 
          fm3.Show; 
          Parent := fm3; 
    end; 
      

  9.   

    谢谢baseyueliang ,点击button1时,form3中显示了from2,但出现了另外一个问题,form1中的form2消失了
      

  10.   

    自己搞定了,谢谢各位
    <Unit1>
    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs;type
      TForm1 = class(TForm)
        procedure FormShow(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;
      frm:TForm;implementation
    uses unit2;
    {$R *.dfm}procedure TForm1.FormShow(Sender: TObject);
    begin
      frm:=TForm2.Create(form1);
            frm.Parent:=form1;
            frm.BorderStyle:=bsNone;   
            frm.Align:=alClient;
            frm.Color:=clred;   
            frm.Show;
    end;end.<Unit2>
    unit Unit2;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;type
      TForm2 = class(TForm)
        Button1: TButton;
        Memo1: TMemo;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form2: TForm2;implementation
    uses unit3;
    {$R *.dfm}procedure TForm2.Button1Click(Sender: TObject);
    begin
      form3.Show;
    end;end.<Unit3>
    unit Unit3;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs;type
      TForm3 = class(TForm)
        procedure FormCreate(Sender: TObject);
        procedure FormShow(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form3: TForm3;
      frm:TForm;implementation
    uses unit2;
    {$R *.dfm}procedure TForm3.FormCreate(Sender: TObject);
    begin
            
            frm:=TForm2.Create(form3);
            frm.Parent:=form3;
            frm.BorderStyle:=bsNone;
            frm.Align:=alClient;
            frm.Color:=clred;
            frm.Show;
    end;procedure TForm3.FormShow(Sender: TObject);
    begin
      form3:=tform3.Create(self);
    end;end.