Delphi - 窗体中的窗体
出于美观原因,我想在另一个表单之上显示一个表单,就像它是一个组件一样,比如 TPanel。它应该随父级一起调整大小,当父级被标题栏拖动时四处移动,等等。
-----------------------------
| main form component 1 |
-----------------------------
| main | the 'embedded' |
| form | form goes here |
|comp 2| |
-----------------------------
我可以这样做吗?如果是这样怎么办?
我现在倾向于MDI...
For aesthetic reasons, I want to show a form on top of another form, just as if it were a component, say like a TPanel. It should resize with the parent, move around as the parent is dragged by its title bar, etc.
-----------------------------
| main form component 1 |
-----------------------------
| main | the 'embedded' |
| form | form goes here |
|comp 2| |
-----------------------------
can I do that? If so how?
I am now leaning towards MDI...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在设计时将面板放置在您希望嵌入表单的位置。在运行时,创建表单,然后将嵌入表单的 Parent 属性设置为面板。
编辑:
如果您想停止显示窗口标题和边框,请将其添加到
FormCreate()
的底部顺便说一句,我不提倡使用父级表单框架,只是回答问题。框架很棒(我一直使用它们),但它们与表单完全不一样。它们几乎就像一个带有控件的面板。
例如,框架没有 OnCreate 事件,也没有 OnShow 事件,当您重用它们并需要这种行为时,有时会很痛苦。
氮@
Put a panel where you want your embedded form to be at design time. At run time, Create the form, then set the embedded form's Parent property to the panel.
Edit:
If you want to stop the window title and border from being displayed, add this to the bottom of the
FormCreate()
BTW, I am not advocating using parented forms over frames, just answering the question. Frames are great (I use them all the time), but they are not exactly the same as Forms. They are almost exactly like a panel with controls on it.
For instance, a frame does not have an OnCreate event, nor an OnShow event, which can be painful sometimes when you are reusing them and need that sort of behavior.
N@
您可以使用框架。
You could use a frame.
本机 win32 MDI 被认为是“过时的”。我想您可能正在寻找类似 JEDI JvDocking 库的东西。我用它来模拟 MDI,但没有使用 win32 MDI 支持。
Native win32 MDI is considered "out of date". I think you might be looking for something like the JEDI JvDocking library. I use it to emulate MDI but without using the win32 MDI support.