如何在树状列表中隐藏特定的名称文件夹?我有这样的树列表
我希望隐藏文件夹名称New folder
和pdf
。我是从Load Data Dir做出来的。我通过放置if
Dim rootfolder As String = "C:\\FFOutput"
Private Sub TreeList1_VirtualTreeGetCellValue(ByVal sender As Object, ByVal e As DevExpress.XtraTreeList.VirtualTreeGetCellValueInfo) Handles TreeList1.VirtualTreeGetCellValue
Dim di As New DirectoryInfo(CStr(e.Node))
If di.Name <> "New folder" Then
If e.Column Is TreeListColumn1 Then
e.CellData = di.Name
End If
If e.Column Is TreeListColumn2 Then
e.CellData = e.Node.ToString
End If
If e.Column Is TreeListColumn3 Then
If IsFile(di) Then
e.CellData = New FileInfo(CStr(e.Node)).Extension
Else
e.CellData = Nothing
End If
End If
End If
End Sub
Private Sub TreeList1_VirtualTreeGetChildNodes(ByVal sender As Object,
ByVal e As DevExpress.XtraTreeList.VirtualTreeGetChildNodesInfo) _
Handles TreeList1.VirtualTreeGetChildNodes
If loadDrives = False Then
Dim root As String() = Directory.GetDirectories(rootfolder)
e.Children = root
loadDrives = True
Else
Try
Dim di As New DirectoryInfo(CStr(e.Node))
If di.Name <> "New folder" Then
Dim path As String = CStr(e.Node)
If Directory.Exists(path) Then
Dim dirs As String() = Directory.GetDirectories(path)
Dim files As String() = Directory.GetFiles(path)
Dim arr(dirs.Length + files.Length) As String
dirs.CopyTo(arr, 0)
files.CopyTo(arr, dirs.Length)
e.Children = arr
Else
e.Children = New Object() {}
End If
End If
Catch
End Try
End If
End Sub
它就像这样