1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| ListView1.View = View.Tile
ListView1.FullRowSelect = True
Dim fileNames1 = My.Computer.FileSystem.GetFiles(
FolderBrowserDialog1.SelectedPath, FileIO.SearchOption.SearchTopLevelOnly, "*.*")
For Each fileName1 As String In fileNames1
Dim fi As New FileInfo(fileName1)
'On récupère l'icone associé au fichier
Dim iconFile = System.Drawing.Icon.ExtractAssociatedIcon(fi.FullName)
'On instancie un listviewitem
Dim fileInfo = My.Computer.FileSystem.GetFileInfo(fileName1)
Dim FichierInfo As System.IO.FileInfo = New System.IO.FileInfo(fileName1)
Dim buttonElement As New Button
Dim lvi As New ListViewItem(fi.Name)
buttonElement.Text = fi.Name
buttonElement.Font = New Font("Lucida Console", 11)
buttonElement.Image = iconFile.ToBitmap
buttonElement.ImageAlign = ContentAlignment.TopLeft
buttonElement.TextAlign = ContentAlignment.TopLeft
buttonElement.TextImageRelation = TextImageRelation.ImageBeforeText
buttonElement.Width = ListView1.Width - 4
buttonElement.Height = 120
buttonElement.Parent = ListView1
ListView1.Controls.Add(buttonElement)
buttonElement.Show()
Next |
Partager