TreeView详细架构问题

发布于 2024-11-08 15:20:04 字数 256 浏览 0 评论 0原文

我正在开发一个 Windows 窗体应用程序,我的客户希望左侧有一个带有节点的 TreeView,单击这些节点后,用户可以在右侧的详细屏幕中工作。最简单的方法是创建在单击相应节点之前禁用的面板。然而,这个应用程序正在不断发展,其中太多内容都以主要形式存在。

我想知道是否可以为每个节点创建一个表单,该表单将打开并扩展到右侧的详细信息区域,然后在完成后关闭。这样我就没有单一的整体形式,但我不确定如何去做。

有人对如何做类似的事情有任何见解吗?

谢谢。

I've got windows form app I'm developing, and my client wants a TreeView on the left with nodes that when clicked allow their users to work in detail screens on the right. The simplest approach was to create panels which are disabled until the appropriate node is clicked. However, this app is growing and way too much of it is living in the main form.

I'm wondering if it is possible to have one form per node that will open and expand into the detail area on the right, and then close when I am done with it. That way I don't have a single monolithic form, however I am not sure of how to go about that.

Anybody have any insight into how to do something like that?

Thanks.

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

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

发布评论

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

评论(3

冷弦 2024-11-15 15:20:04

您应该尝试使用UserControl

基本上,每个 UserControl 是一个表单(或多或少),您可以将其添加到主表单中,就像添加任何其他控件一样。

You should try using UserControls.

Basically, each UserControl is a form (more or less) that you can add to your main form just like you would any other control.

浪推晚风 2024-11-15 15:20:04

我将为每个页面继承Panel,将每个Panel 派生对象的实例附加到每个TreeView 节点的Tag 属性,并在选择节点时显示该实例(Dock=Fill)。

I would inherit from Panel for each page, attach an instance of each Panel-derived object to the Tag property of each TreeView node, and display that (Dock=Fill) when a node is selected.

魄砕の薆 2024-11-15 15:20:04

您可以使用拆分控件并在右侧加载表单,但需要正确排列它。正如 @codethis 提到的,用户控件足以处理这些,因为它们的代码是单独编写的。只需传递参数(来自节点选择)。

您可能需要多个用户控件,并根据屏幕变化将它们放置在表单中。

You can use split controls and load the forms right side but needs to arrange it correctly. As @codethis mentioned, usercontrol is best enough to handle these as their code is written separately. Just you need to pass the parameter (from node selection).

You may need to multiple user controls and place them in your form according to your screen changes.

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