zoukankan      html  css  js  c++  java
  • VB6实现ListView各行间隔颜色

    建立新工程,添加一个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使用其它特别的图像也可以。

  • 相关阅读:
    点击退出 防止回退
    AngularJS select中ngOptions用法详解
    git hub
    .ashx datatable转excel
    写日志 log 到文件夹
    easyui layout 布局title
    easyui tree 折叠节点
    转json using指令
    Qt QWindow转QWidget
    CEF 重写弹窗事件
  • 原文地址:https://www.cnblogs.com/yzx99/p/1453269.html
Copyright © 2011-2022 走看看