我正在尝试使用 ListView 而不是列表框,以便对某些行的背景颜色进行一些控制。
例如,我实现了整个列表视图背景颜色的更改:BackColor =&HC000&-但是,我想使其中一行成为其自身颜色。
With ListView1
.View = lvwReport
.CheckBoxes = True
.FullRowSelect = True
.Gridlines = True
.BackColor = &HC000&
With .ColumnHeaders
.Clear
.Add , , "Language", 70
.Add , , "Subitem-1", 70
.Add , , "Subitem-2", 70
End With
Dim li As ListItem
Set li = .ListItems.Add()
li.Bold = True 'Bold item
'li.BackColor = Color.Gold
li.ListSubItems.Add , , "Subitem 1.1"
li.ListSubItems.Add , , "Subitem 1.2"
Set li = .ListItems.Add()
li.ListSubItems.Add , , "Subitem 2.1"
li.ListSubItems.Add , , "Subitem 2.2"
Set li = .ListItems.Add()
li.ListSubItems.Add , , "Subitem 3.1"
li.ListSubItems.Add , , "Subitem 3.2"
.ColumnHeaders(1).Position = 2
End With