我有以下功能:
public void AddPath(String full_path)
{
TreeView tree_view = TheTreeView;
String[] split_path;
TreeNodeCollection current_nodes;
if (tree_view == null)
return;
if (String.IsNullOrEmpty(full_path))
return;
split_path = full_path.Split(tree_view.PathSeparator.ToCharArray());
current_nodes = tree_view.Nodes;
for (Int32 i = 0; i < split_path.Length; i++)
{
TreeNode[] found_nodes = current_nodes.Find(split_path[i], false);
if (found_nodes.Length > 0)
{
current_nodes = found_nodes.First().Nodes;
}
else
{
TreeNode node;
node = new TreeNode();
node.Name = split_path[i]; // name is the same thing as key
node.Text = split_path[i];
current_nodes.Add(node);
current_nodes = node.Nodes;
}
}
}
我需要从一个单独的线程调用这个函数。我该怎么做?我知道如何调用 TreeView.Nodes.Add() 但我该怎么做呢?0.o
-斯文