0

모든 미디어를 찾고 재생하고 표시하는 응용 프로그램을 개발 중이지만 주로 음악을 봅니다. vb.net에서 Visual Studio 2012를 사용하고 있습니다. 내 양식에는 Windows Media Player (WMP)와 두 개의 목록보기가 있습니다. 첫 번째 listview (lvFolders)는 드라이브 위치의 모든 폴더를 표시합니다. 폴더를 선택하면 자동으로 모든 파일 (미디어 트랙)을 두 번째 listview (lvPlaylist)에로드하고 WMP를 사용하여 첫 번째 트랙 재생을 시작합니다. 그것은 모두 잘 작동합니다.Listview에서는 각 항목 (폴더)에 각 폴더의 이미지를 할당합니다.

각 폴더 (500+)에는 "front.bmp"라는 앨범의 표지가 있습니다. 나는 내 삶이 내가 잘못하고있는 것을 해결할 수는 없다. listview이 폴더를 채우는 동안 나는 그 폴더 내에있는 각 이미지 파일을 imagelist에로드하고 이미지를 사용하여 큰 아이콘으로 폴더를 표시하려고합니다. 그 결과 500 개 이상의 대형 폴더가 각각의 앨범 표지를 imagelist에서 표시합니다.

특히 Folder Browser Dialog 또는 Open File Dialog를 사용하고 싶지 않았습니다. 이 응용 프로그램은 내 개인적인 용도로 터치 기반 응용 프로그램 용입니다.

내 딜레마를 이해하는 데 도움이 될 수 있도록 제 코드를 첨부했습니다.

Private Sub LoadFolders_Click(sender As Object, e As EventArgs) Handles btnLoadFolders.Click 

    For Each strDir As String In My.Computer.FileSystem.GetDirectories("E:\Music\TEST") 


     Dim imageListLarge As New ImageList() 
     Dim strAlbumArt As String = strDir & "\" & (My.Computer.FileSystem.GetName(strDir)) & ".bmp"  'URL of the image 
     imageListLarge.ColorDepth = ColorDepth.Depth32Bit             'Set the colour 
     imageListLarge.ImageSize = New Size(128, 128)              'Set image size 
     imageListLarge.Images.Add(strAlbumArt, Image.FromFile(strAlbumArt))         'Add image to image list 
     lvFolders.LargeImageList = imageListLarge               'Assign the imagelist to the listview 

     Dim NewItem As New ListViewItem(My.Computer.FileSystem.GetName(strDir), strAlbumArt)    'Create Column 1 data 
     NewItem.SubItems.Add(My.Computer.FileSystem.GetFileInfo(strDir).FullName)       'Create Column 2 data 

     lvFolders.Items.Add(NewItem)                  'Load into listview 

    Next 

End Sub 
+0

'My.Computer.FileSystem.GetName'은 경로에서 파일 이름을 구문 분석하지만이 경우에는 "strDir"을 전달합니다. "strDir"은 "E : \ Music \ TEST"의 하위 디렉토리입니다. Dim strAlbumArt As String = strDir & "\"& "front.bmp"는 더 비슷해야합니다. –

답변

0
Dim strAlbumArt As String = strDir & "\" & (My.Computer.FileSystem.GetName(strDir)) & ".bmp" 

그 안에 "front.bmp"을 가지고 있지 않습니다. Dim strAlbumArt As String = strDir & "\front.bmp과 같은 의미가 아닙니다.

관련 문제