Hello,
Your question seems a bit vague but interesting, I would recommend using a
treeview becuase it supports nodes and images like you said.
List<treenode> parents = new List<treenode>();
List<treenode> nodes = new List<treenode>();
string[] temp = new string[256];
XmlTextReader tr = new XmlTextReader(File.Open(@"C:/Users/Austin/Desktop/example.xml", FileMode.Open));
while (tr.Read())
{
if (tr.NodeType == XmlNodeType.Element && !tr.HasValue)
parents.Add(new TreeNode("<" + tr.Name + ">"));
if (tr.NodeType == XmlNodeType.Element && tr.HasValue)
temp[tr.LineNumber] = "<" + tr.Name + ">";
if (tr.NodeType == XmlNodeType.Text)
nodes.Add(new TreeNode((temp[tr.LineNumber] ?? "") + tr.Value));
}
tr.Close();
ImageList list = null;
treeView1.ImageList = list;
TreeNode[] collection = new TreeNode[parents.Count];
for (int i = 0; i < parents.Count; i++)
{
collection[i] = new TreeNode(parents[i].Text, nodes.ToArray());
collection[i].ImageIndex = 1;
}
treeView1.Nodes.AddRange(collection);