Suppose that in this path: C:\...\imagem
have 3 folders: fotos
, wallpaper
and ferias
. What I would like to do and leave them like this:
Photos
imagem1 imagem2 imagem3
imagem4 imagem5 imagem6
Wallpaper
imagem1 imagem2 imagem3
imagem4 imagem5 imagem6
Fairs
imagem1 imagem2 imagem3
imagem4 imagem5 imagem6
I have already taken the paths and the images, but to catch up to that listview does anyone know how I do it?
If possible using vb's proprietary language I do not know C #
Edit:
I'm using a Treeview to list all the pastes of a directory that have .jpg images.
Dim td As Threading.Thread
Private Sub Anteslerdiretorio()
Dim nome As String = "Imagem"
Dim caminho As String = "C:\Users\lucas\Imagem\fotos"
Dim cont As Integer = 0
'Dim node As TreeNode = New TreeNode(nome)
Me.Invoke(New Action(Function() Me.TreeView1.Nodes.Add(nome)))
LerDiretoriosEArquivosRecursivamenteEAdicionarAaTreeView(caminho, TreeView1.Nodes(cont))
cont += 1
End Sub
Private Sub LerDiretoriosEArquivosRecursivamenteEAdicionarAaTreeView(ByVal diretorio As String, ByVal noPai As TreeNode)
Dim dirsFilhos() As String = System.IO.Directory.GetDirectories(diretorio)
If dirsFilhos.Length = 0 Then
Return
Else
For Each dirFilho In dirsFilhos
Try
For Each arquivos In FileIO.FileSystem.GetFiles(dirFilho, FileIO.SearchOption.SearchAllSubDirectories, "*.jpg", "*.png")
If Len(arquivos) > 0 Then
Dim noFilho As TreeNode = New TreeNode(dirFilho)
Me.Invoke(New Action(Function() noPai.Nodes.Add(noFilho)))
'noPai.Nodes.Add(noFilho)
LerDiretoriosEArquivosRecursivamenteEAdicionarAaTreeView(dirFilho, noFilho)
Exit For
End If
Next
Finally
End Try
Next
End If
End Sub
Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles Button1.Click
td = New Threading.Thread(AddressOf Anteslerdiretorio)
td.Start()
End Sub
And then using an AfterSelect event from the treeview to get the selected path in the Treeview and the images in the selected folder.
Private Sub PegaCaminhoTreeview(sender As Object, e As TreeViewEventArgs) Handles TreeView1.AfterSelect
If TreeView1.SelectedNode Is Nothing Then
Exit Sub
End If
Dim thumbnail As New ImageList With {.ImageSize = New Size(256, 200), .ColorDepth = ColorDepth.Depth32Bit}
Dim caminho_saida As String = TreeView1.SelectedNode.Text
Dim xx As Image
Try
For Each caminho_imagens In FileIO.FileSystem.GetFiles(TreeView1.SelectedNode.Text, FileIO.SearchOption.SearchTopLevelOnly, "*jpg", "*.png")
Using str As Stream = File.OpenRead(caminho_imagens)
xx = Image.FromStream(str)
thumbnail.Images.Add(xx)
End Using
Next
Finally
End Try
End Sub
What I would like to know is how do I make a display of this type:
Only with the name of the last folder being the name of the group and their respective images within the folder group.