按钮监听事件,调用。 

private void button2_Click(object sender, EventArgs e)
        {            

            foreach (TreeNode n in TreeView1.Nodes)
            {
                ErgodicTreeView(n);
            }
        }

 查找到当前节点是否有需要的节点,如果有,然后遍历父节点,将父节点全部展开,找到后选中添加背景颜色区分。

void ErgodicTreeView(TreeNode tn)
        {
            if (tn == null) return;
            //查找到某节点时
            if (tn.Text.Equals("英山县"))
            {
                //遍历递归获取父节点,将父节点全部展开
                prenode(tn);
                //选中某节点,并加背景颜色
                TreeView1.SelectedNode = tn;
                TreeView1.SelectedNode.BackColor = System.Drawing.Color.Red;
            }
            foreach (TreeNode n in tn.Nodes)
            {
                ErgodicTreeView(n);
            }
        }
        void prenode(TreeNode m)
        {
           

            if (m.Parent.Text != null)
            {
                m.Parent.Expand();
                //当为项级节点时
                if (m.Parent.Level == 0)
                {
                    m.Parent.Expand();
                }
                 //不是项级节点时
                else
                {
                    prenode(m.Parent);
                }

            }
           
        }