当我在Delphi中搜索可停靠的表单并找到a post by Zibadian on Programmers Heaven时:
First off: The windows in the Delphi IDE aren’t MDI forms,by SDI forms.
Now to create a dockable window.
Form2 will be dockable and Form1 will be the place to dock it to. Place a control (such as a TPanel) on Form1 to serve a DockSite. Make sure that you set the DockSite and the UseDockManager properties to true for that control.
For Form2 set the DragKind to dkDrop,the DragMode to dmAutomatic and UseDockManager to true.
That was the basic dock function. If you run your program,show the Form2 and drag that form over the docksite,it should dock at that site. You can even undock it by grabbing the “caption” as you have seen in the IDE.
对我来说,该方法非常缓慢地移动可停靠的形式.然而,Zibadian的答案继续描述IDE如何做到:
The dock-method of the IDE is a little more complex,since you don’t see the docksite. I think,you need to write a Form1.OnDockOver or Form1.OnDockDrop to perform that. That (Those) event(s) need to show the docksite at the appropriate location.