SplitContainer 的面板作为其他窗体的 MDI 父级

发布于 2024-10-03 02:41:58 字数 272 浏览 0 评论 0原文

我有一个添加了 Splitcontainer 的控件。我想放置 第二个面板 (Panel2) 上的另一个表单。然而,这是不可能的 将全新表单的 MDIParent 属性设置为 Panel2

因此,问题是 - 如何将 SplitContainer's 面板设置为另一个控件的 MDIParent

预先感谢您的线索!

干杯

I have got a control with a Splitcontainer added. I want to place
another forms on the second panel (Panel2). However, it is not possible to
set the MDIParent property of a brand new form to Panel2.

Thus, the question is - how can I set the SplitContainer's panel as the MDIParent for another controls?

Thank you in advance for the clues!

cheers

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

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

发布评论

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

评论(3

终遇你 2024-10-10 02:41:58

如果你想制作Panel-Splitter-MdiClient Form,请参阅c#中的面板和MDI< /a>

If you want to make Panel-Splitter-MdiClient Form see panel and MDI in c#

心在旅行 2024-10-10 02:41:58

MDIParent 只能是另一个表单。您需要做的就是在子表单上将 TopLevel 设置为 False。然后,您可以将其添加到任何控件,就像添加到任何其他控件一样(通过将其添加到父控件的 Controls 集合中)。但是,它不会像在 MDI 容器中那样工作(因为您无法最小化或最大化它)。

An MDIParent can only be another Form. What you need to do is set TopLevel to False on the child Form. Then you can add it to any control just like it was any other control (by adding it to the parent control's Controls collection). However, it won't work like it does in an MDI container (as in you won't be able to minimize or maximize it).

国产ˉ祖宗 2024-10-10 02:41:58

如果您的目的是使用 splitcontainer 加载不同的子表单,这可能会有所帮助。您可以使用从包含普通 WinForm 拥有的所有小部件的面板派生的类,而不是使用 WinForms。要显示它们,只需将它们添加到 splitcontainer 的 Panel2 控件集合中即可。

要记住的一些事件和方法是:

  • subformPanel.ParentChanged(进行一些初始化并订阅任何父事件)
  • subformPanel.ParentChanged(进行一些清理并取消订阅父事件)
  • Parent.Controls.Remove(销毁 subformPanel)

If your intent is to use the splitcontainer to load different subforms this may help. Instead of using WinForms, you could use classes derived from panels containing all the widgets that a normal WinForm would have. To display them, simply add them to your splitcontainer's Panel2 controls collection.

Some events and methods to keep in mind are:

  • subformPanel.ParentChanged (do some initialization and subscribe to any parent events)
  • subformPanel.ParentChanged (do some cleaning up and unsubscribe to parent events)
  • Parent.Controls.Remove (destroy the subformPanel)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文