var
Form1: TForm1;
implementation
uses Unit2;
{$R *.dfm}
PRocedure TForm1.Button1Click(Sender: TObject);
begin
//把Form2的Parent改为Form1
Form2 := TForm2.CreateParented(Form1.Handle);
Form2.Show;
//使得Form2处于激活状态
SendMessage(Form2.Handle, WM_NCACTIVATE, Ord(True), 0);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Form2.Close;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
//记得加上这一句
if Form2.Showing then Form2.Close;
end;
end.
新闻热点
疑难解答