操作方法是:
///
/// 获取指定value值的节点
///
/// 指定节点
/// value值
///
private TreeNode FindNodeByValue(TreeNode tnParent, string strValue)
{
if (tnParent == null) return null;
if (tnParent.Value == strValue) return tnParent;
TreeNode tnRet = null;
foreach (TreeNode tn in tnParent.ChildNodes)
{
tnRet = FindNodeByValue(tn, strValue);
if (tnRet != null) break;
}
return tnRet;
}
///
/// 获取指定Text值的节点
///
/// 指定节点
/// Text值
///
private TreeNode FindNodeByText(TreeNode tnParent, string strText)
{
if (tnParent == null) return null;
if (tnParent.Text == strText) return tnParent;
TreeNode tnRet = null;
foreach (TreeNode tn in tnParent.ChildNodes)
{
tnRet = FindNodeByText(tn, strText);
if (tnRet != null) break;
}
return tnRet;
}
TreeView1.SelectedItem.Text
加点悬赏分我马上就告诉你答案,都三级的人了还这么小气怎么都得给一点啊