如何在 .NET 中创建基于思维导图的基于树视图的 Windows 应用程序

发布于 2024-12-22 09:21:14 字数 367 浏览 3 评论 0原文

我希望为我的 .NET Windows 应用程序 (WPF) 创建一个直观的树视图结构(在思维导图的类似线上)。

类似于 thisthis

我最初计划开发一个示例应用程序,其中我的应用程序仅读取底层结构化 XML 来创建类似可视化的思维导图并将其显示给用户。用户可以选择任何显示的树节点。如果该节点有子节点,则当用户点击对应的父节点时会显示子节点。

为了实现这一目标,我首先需要在正确的方向上得到提醒或帮助。非常感谢任何帮助

I'm looking to create an intuitive tree-view structure (on the similar lines of a Mind-map) for my .NET Windows Application (WPF).

Something on the similar lines as this or this

I'm initially planning to develop a sample application, wherein my application just reads an underlying structured XML to create a mind-map like visualization and display it to the user. The user can select any of the displayed tree node. If the node has child nodes, it shall be displayed when the user clicks on the corresponding parent node.

To achieve this i need a heads up or help in the right direction to begin with. Any help is deeply appreciated

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

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

发布评论

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

评论(1

她如夕阳 2024-12-29 09:21:14

我之前在 WPF 中从头开始制作过网络图,但没有制作过思维导图。这并不容易,需要花费几页纸来解释每个步骤。因此,我在下面快速介绍了如何完成我的网络地图。我认为除了节点和节点连接器的布局和视觉表示之外,不会有太大区别。

第一个开始的地方是你的收藏。 MSDN 提供了一个杀手级有向图集合:http: //msdn.microsoft.com/en-us/library/ms379574(v=vs.80).aspx

建立集合后,您将需要扩展 Panel 类,以便它可以为您执行布局。我不知道任何现有的思维导图布局面板,但这里有一个径向面板布局的链接:http://msdn.microsoft.com/en-us/library/ms771363(v=vs.90).aspx。它应该向您展示将内容放置在自定义布局中所需的步骤。

您还需要一种方法来直观地表示有向图节点。 WPF 的美妙之处在于您可以创建自己的用户控件,并且如果创建的面板布局正确,它将执行自定义控件的所有布局工作。我的网络图只是一个以椭圆为背景的用户控件,放入径向面板中。

最后一步是能够检查图形集合并绘制连接节点之间的连接器。在我的有向图集合中,我添加了一个名为 Tag 的类型对象的属性,并存储了节点的 UserControl 版本。这样我就知道所连接的用户控件的坐标,并且可以使用折线将它们连接起来。我认为对你来说不同的是你会希望你的连接器作为图像。

这是快速版本。我很想在这里发布显示更多内容的源代码,但我编写它是为了工作,他们会杀了我。

I've done a network map from scratch before in WPF but not a Mind Map. It's not easy and would take a few pages to explain every step. So I've given a quick startup below on how I accomplished my network map. I don't think there would be much difference other than the layout and the visual representation of the nodes and node connectors.

The first place to start is your collection. MSDN has a killer Directed Graph collection available here: http://msdn.microsoft.com/en-us/library/ms379574(v=vs.80).aspx.

After your collection is established, you will need to extend the Panel class so it can perform your layout for you. I don't know of any existing Mind Map layout panels, but here's a link to a Radial Panel layout: http://msdn.microsoft.com/en-us/library/ms771363(v=vs.90).aspx. It should show you the steps required to place things in a custom layout.

You will also need a way to visually represent your directed graph nodes. The beautiful thing about WPF is you can create your own UserControls and if your panel is created to layout properly, it will perform all the layout work for your custom controls. My network map was simply a UserControl with an ellipse as the background, thrown into a Radial Panel.

The final step is the ability to examine your graph collection and draw the connectors between connected nodes. In my directed graph collection I added a property of type object called Tag and I stored the UserControl version of the node. This way I know the coordinates of the connected UserControls and I can connect them with a PolyLine. I think the difference for you is you would want your connector as Image.

That's the quick version. I'd love to post source code here that shows more, but I wrote it for work and they would kill me.

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