如何制作像 IDE 一样的可停靠表单,而不会出现可停靠表单非常缓慢的冻结移动? [英] How do I make dockable forms like the IDE's without the very slow freezing movement of the dockable form?

查看:17
本文介绍了如何制作像 IDE 一样的可停靠表单,而不会出现可停靠表单非常缓慢的冻结移动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何实现 IDE 方法或最终制作基本的停靠方法,而不会出现可停靠窗体非常缓慢的冻结移动?

How do I do the IDE method or eventually make the basic dock method without the very slow freezing movement of the dockable form?

当我在 Delphi 中搜索可停靠表单并找到 子巴点在程序员天堂的帖子:

When I Googled for dockable forms in Delphi and found a post by Zibadian on Programmers Heaven:

首先:Delphi IDE 中的窗口不是 MDI 表单,而是 SDI 表单.

First off: The windows in the Delphi IDE aren't MDI forms, by SDI forms.

现在创建一个可停靠窗口.

Now to create a dockable window.

Form2 将是可停靠的,而 Form1 将是停靠它的地方.在 Form1 上放置一个控件(如 TPanel)以提供 DockSite.确保将该控件的 DockSite 和 UseDockManager 属性设置为 true.

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.

对于 Form2,将 DragKind 设置为 dkDrop,将 DragMode 设置为 dmAutomatic 并将 UseDockManager 设置为 true.

For Form2 set the DragKind to dkDrop, the DragMode to dmAutomatic and UseDockManager to true.

这是基本的停靠功能.如果您运行程序,显示 Form2 并将该表单拖到停靠站点上,它应该停靠在该站点上.您甚至可以通过在 IDE 中看到的标题"来取消停靠.

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 是如何做到的:

For me, that method moves the dockable form very slowly. However, Zibadian's answer continues to describe how the IDE does it instead:

IDE 的停靠方法稍微复杂一些,因为您看不到停靠站点.我认为,您需要编写一个 Form1.OnDockOver 或 Form1.OnDockDrop 来执行该操作.该(那些)事件需要在适当的位置显示停靠点.

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.

推荐答案

看看使用TDockTabSetJeremy North 的组件 文章.它已经有几年历史了,但应该会给您一些有用的指导.

Have a look at the Using the TDockTabSet component article by Jeremy North. It is a few years old but should give you some helpful pointers.

这篇关于如何制作像 IDE 一样的可停靠表单,而不会出现可停靠表单非常缓慢的冻结移动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆