这是一种窗口融合技术,请看例子:
panel1:
align:alleft;
docksite:true;
usedockmanager:true;
panel2:
align:albottom;
docksite:true;
usemanager:true;
form2:
anchors:[aktop,akbottom,akleft,akright];
dragmode:dmautomatic;
dragkind:dkdock;
设置button1的onclick事件,对应的代码如下:
procedure TForm1.Button1Click(Sender: TObject);
begin
form2.Show;
a:=form1.caption;
b:=form2.caption;
end;
设置panel1和panel2的onundock事件,代码如下:
procedure TForm1.Panel1UnDock(Sender: TObject; Client: TControl; NewTarget: TWinControl; var Allow: Boolean);
begin
form1.caption:=a;
form1.Refresh;
end;
设置panel1和panel2的ondockdrop事件,代码如下:
procedure TForm1.Panel1DockDrop(Sender:TObject; Source: TDragDockObject; X, Y: Integer);
begin
form1.Caption:=a+','+b;
form1.Refresh;
end;
其中a,b为String型变量,用以保存窗口的最初标题,在form1的接口处声明。