将表单停靠到另一个表单面板

发布于 2024-08-04 08:42:53 字数 77 浏览 2 评论 0原文

是否可以将 form1 停靠到另一个 form2 中包含的面板? 我正在从 form2 事件中使用 ShowDialog 启动 form1。

Is it possible to dock a form1 to a panel contained in another form2?
I'm launching form1 with ShowDialog from a form2 event.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

水晶透心 2024-08-11 08:42:53

不使用 ShowDialog (甚至 Show),不。已经显示为顶级窗体的窗体以后不能添加为任何其他控件的子控件。您可以尝试通过监视 LocationChanged 事件将表单保持在一组特定的屏幕边界内,但这会在屏幕上显得不稳定。

Not with ShowDialog (or even Show), no. A form that has already been displayed as a top-level form cannot later be added as a subcontrol of any other control. You can try to keep the form within a particular set of screen bounds by monitoring the LocationChanged event, but that will appear jerky on the screen.

因为看清所以看轻 2024-08-11 08:42:53

考虑将 form1 中的控件提取到 UserControl 中。在 form1 上使用该 UserControl(假设您需要它作为表单以及停靠控件),然后将 UserControl 停靠在 form2 上以实现所需的功能。

Consider extracting the controls out of form1 into a UserControl. Use that UserControl on form1 (assuming you need it as a form as well as the docked control), then dock the UserControl on form2 to implement the desired functionality.

瘫痪情歌 2024-08-11 08:42:53

考虑使用完全免费的对接库来开发链接提供的 Visual Studio .Net 样式应用程序。相信我,这是商业质量且无错误的代码!

Consider using the COMPLETELY FREE docking library to develop Visual Studio .Net style applications provided by this link. Believe me, it's a commercial quality and bug-free code!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文