yzx99

导航

 

建立新工程,添加一个ListView控件与一个Picture控件,然后输入如下代码:
Option Explicit

Private Sub Form_Load()
Dim i As Long
  '列表框的属性及准备数据
  ListView1.View = lvwReport
  ListView1.ColumnHeaders.Add , , "This is Just a Simple Example"
  ListView1.ColumnHeaders(1).Width = 3000
  For i = 1 To 33
    ListView1.ListItems.Add , , "This is item number " & CStr(i)
  Next

  '图像控件需要设的属性
  Picture1.BorderStyle = vbBSNone
  Picture1.AutoRedraw = True
  'Picture1.Visible = False
 
  '高度为两行列表
  Picture1.Width = ListView1.Width
  Picture1.Height = ListView1.ListItems(1).Height * 2
 
  '画出两行间隔颜色
  Picture1.ScaleMode = vbUser
  Picture1.ScaleHeight = 2
  Picture1.ScaleWidth = 1
  Picture1.Line (0, 0)-(1, 1), vbWhite, BF
  Picture1.Line (0, 1)-(1, 2), RGB(227, 241, 226), BF
 
  '最关键的地方
  ListView1.PictureAlignment = lvwTile
  ListView1.Picture = Picture1.Image
End Sub

由此可以推断,如果要在ListView使用其它特别的图像也可以。

posted on 2009-05-09 17:07  yzx99  阅读(1158)  评论(0编辑  收藏  举报