To fireman119
如果我对你的提问没理解错,下面这段代码对你应该有用。
-------------------------------------------------------------
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm1 = class(TForm)
Panel1: TPanel;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
Tempform:Tform;
begin
tempform:=TForm2.Create(self);
tempform.Parent:=panel1;
tempform.BorderStyle:=bsnone;
tempform.Show;
Tempform.Left:=panel1.Left;
Tempform.Top:=panel1.Top;
end;
end.
---------------------------------------------------------------
如前面 berock 所说,用Frame来代替form2也是不错的方法。