2010-07-10 2 views
1

포스터와 DVD 컬렉션의 제목으로 listview (타일)를 채우려하고 있지만 제목 만 표시됩니다. .?. listview 타일이 이미지를 표시하지 않음 (.NET2.0, VB, winforms)

내 코드입니다 : 사전에

Private Sub fillListView(ByVal listView As System.Windows.Forms.ListView, ByVal col As Collection) 
listView.Items.Clear() 
myImageList = New ImageList() 
For Each item As bsDVD In col 
    Try 
    myImageList.Images.Add(Image.FromFile(Application.StartupPath & item.PosterURL)) 
    Catch ex As Exception 
    MessageBox.Show(ex.message) 
    End Try 
Next 
myImageList.ImageSize = New Size(32, 32) 
listView.LargeImageList = myImageList 
For Each item As bsDVD In col 
    listView.Items.Add(item.Titel) 
Next 
End Sub 

많은 그것은 내가 바보 같은 실수를하거나 누군가가 나를 도울 수 있기를 바랍니다나요 :(작업을 진행하지 못할 시도

타이


타이 저를 도와 주셔서 ...

솔루션 코드를 모두 :

Private Sub fillListView(ByVal listView As System.Windows.Forms.ListView, ByVal col As Collection) 
listView.Items.Clear() 
myImageList = New ImageList() 
myImageList.ImageSize = New Size(70, 100) 
myImageList.ColorDepth = ColorDepth.Depth24Bit 

For Each item As bsDVD In col 
    Try 
    myImageList.Images.Add(Image.FromFile(Application.StartupPath & item.PosterURL)) 
    Catch ex As Exception 
    MessageBox.Show("Kan afbeelding niet inladen!") 
    End Try 
Next 
listView.LargeImageList = myImageList 
Dim mItem As bsDVD 
For i As Integer = 1 To col.Count 
    mItem = CType(col.Item(i), bsDVD) 
    listView.Items.Add(mItem.Titel) 
    listView.Items(i - 1).ImageIndex = (i - 1) 
Next 
End Sub 

답변

2

listviewitem의 이미지 색인을 설정해야합니다.

var lvitem = ListView.Items.Add(item.Titel) 
lvItem.imageIndex = 1 

또는

ListView.Items.Add(item.Titel,1) 

x 번째 항목은 =의 X를-1 imageIndex에 도착

뷰 모드가 세부 사항을 때 또한, 당신은 다른 이미지 속성 (SmallImageList)을 설정해야 할 수도 있습니다.

관련 문제