使用控件需要知道,要想获得树状结构的每个层次中的子文件夹,必须使用递归过程来完成,下面所示代码所执行的工作是:先把一个已经路径的文件夹添加到树状结构中,然后再遍历它的子文件夹:'添加文件夹Public Sub AddDirectory(ByVal strFatherPath As String, ByVal strPath As String, ByVal nodeFather As TreeNode)Dim i As IntegerDim node As New TreeNode'先添加本目录,从文件夹路径分析出文件夹名称node.Text = Strings.Replace(strPath, strFatherPath