VB6 achieves the color of each row interval in listview

Source: Internet
Author: User

Create a new project, add a listview control and a picture control, and enter the followingCode:
Option explicit

Private sub form_load ()
Dim I as long
'Properties Of The ListBox and data preparation
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

'Image control attributes
Picture1.borderstyle = vbbsnone
Picture1.autoredraw = true
'Picture1. Visible = false

'Height is the list of two rows
Picture1.width = listview1.width
Picture1.height = listview1.listitems (1). Height * 2

'Draw the interval color of the two rows
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

'The most important thing
Listview1.picturealignment = lvwtile
Listview1.picture = picture1.image
End sub

It can be inferred that other special images can be used in listview.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.