用listview显示网格数据,如何在第1列中(不是标头)显示imagelist中索引为1的ico图标??

解决方案 »

  1.   

    Dim sl As ListItem
    Set sl = ListView1.ListItems.Add(index,key,text, , 1)
      

  2.   

    up~~~~~~~~~~选中一行时,改变此行ico图表
      

  3.   

    如何实现 选中一行时,改变此行ico图标?
      

  4.   

    Option ExplicitDim OldClick As LongPrivate Sub Form_Load()
            OldClick = 1
            
            With Me.ImageList1
                 .ImageHeight = 25
                 .ImageWidth = 25
                 With .ListImages
                      .Add 1, , Me.Image1
                      .Add 2, , Me.Image2
                 End With
            End With
            
            
            With ListView1
                  .SmallIcons = Me.ImageList1
                  With .ColumnHeaders
                       .Add , , "AA"
                       .Add , , "BB"
                       .Add , , "CC"
                  End With
                  With .ListItems
                       .Add , , "1dfsd", , 1
                       .Add , , "2dfsd", , 1
                       .Add , , "3dfsd", , 1
                       .Add , , "4dfsd", , 1
                  End With
            End With
    End SubPrivate Sub ListView1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
            Dim CurListitem As ListItem
            Dim Flag As Boolean
            
            
            Set CurListitem = Me.ListView1.HitTest(x, y)
            Flag = False
            
            If Not CurListitem Is Nothing Then
                   If CurListitem.Index <> OldClick Then
                          Me.ListView1.ListItems(OldClick).SmallIcon = 1
                   End If
                   
                   CurListitem.SmallIcon = 2
                   OldClick = CurListitem.Index
                   Flag = True
            End If
            
            If Flag = False Then
                  Me.ListView1.ListItems(OldClick).SmallIcon = 1
            End If
            Set CurListitem = Nothing
           
    End Sub
      

  5.   

    我上面贴出来的例子有源程序,你有要吗?、如果要的话,联系我吧,[email protected]
      

  6.   

    楼上的能给我一份吗?
    [email protected]
      

  7.   

    谢谢  flyingZFX(我飞!我飞!我飞呀飞!) 麻烦你给我一份:[email protected]