Would like to know about the TREE VIEW CONTROL which would allow me to select multiple nodes and those selected no开发者_StackOverflowdes can then be dragged and dropped onto the other drive.Is there any Property available for multiple selection or how exactly we can go about doing it.. Thank You
You could use the checked property on the treeview and allow multiple selections based on the state of the checkbox on each node.
You could iterate through the treenodes to see which were checked (you'd really use recursion but here is an example that would iterate through two layers of nodes):
StringBuilder sb = new StringBuilder();
foreach (TreeNode t in treeView1.Nodes)
{
if (t.Checked == true) sb.Append(t.Text + Environment.NewLine);
if (t.Nodes.Count > 0)
{
foreach (TreeNode tt in t.Nodes)
{
if (tt.Checked == true)
sb.Append(tt.Text + Environment.NewLine);
}
}
}
MessageBox.Show(sb.ToString(), "Checked Nodes")
精彩评论