【发布时间】:2014-04-28 18:21:53
【问题描述】:
我是 C# 和 Windows 窗体的新手,想创建一个像这样的简单 UI。
我有以下数组:
string [] projects;
string [] subjects;
string [] experiments;
string [] scans;
string [] files;
编辑:每个子元素都有指示它属于哪个父元素的信息(这可能使其更适合Subject [] subjects, Experiment [] experiments等的排列)
Windows 窗体组件必须以这种方式工作
projects (<- when clicked should show the string array of projects)
|
|--- subjects (<- when clicked should show the string array of subjects)
|
|---experiments (<- when clicked should show the string array of experiments)
|
|--- scans (<- when clicked should show the string array of scans)
|
|----files (<- when clicked should show the string array of files)
我认为 TreeView component 符合要求,但由于我是 Windows 窗体的新手(以及如何完成这件事快速),我想我最好先检查一下。
TreeView 是实现此 UI 的适当方式吗?
【问题讨论】:
-
treeview 很好。用法见dotnetperls.com/treeview。但是您的数组布局“不合适”,因为它不包含有关实际父元素的信息 - 最好看看复合模式:en.wikipedia.org/wiki/Composite_pattern
-
谢谢,我实际上有信息表明每个孩子属于哪个父组件,我认为这会使安排合适。
标签: c# winforms user-interface treeview