سؤال

I'm new to C# and Windows Forms and want to create a simple UI like this.

enter image description here

I have the following arrays:

string [] projects;
string [] subjects;  
string [] experiments;
string [] scans;
string [] files; 

Edit: Each child element has info indicating to which parent it belongs (which may make this more suitable for an arrangement of Subject [] subjects, Experiment [] experiments, etc.)

And the Windows Forms component must work this way

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)

I think the TreeView component fits the bill, but as I'm new to Windows Forms (and what to get this thing done fast), I thought I'd better check in SO first.

Is TreeView the appropriate way to implement this UI?

هل كانت مفيدة؟

المحلول

Yes. The Treeview is the best component for your need.

You can also use this component with a XML file.

For more information, check these links:

http://www.dotnetperls.com/treeview

http://msdn.microsoft.com/pt-br/library/system.windows.forms.treeview(v=vs.110).aspx

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top