- Код: Выделить всё
Const LVM_FIRST As Long = &H1000 ' ListView messages
Const LVM_SUBITEMHITTEST As Long = LVM_FIRST + 57
Const LVM_SETTEXTBKCOLOR = (LVM_FIRST + 38)
Const LVM_GETTEXTBKCOLOR As Long = LVM_FIRST + 37
Const LVM_REDRAWITEMS = LVM_FIRST + 21
'Const LVM_SETTEXTBKCOLOR = 4134 'магическое число
Const LVM_UPDATE = 4138 'еще одно магическое число (взяты мз МСДН-а)
Const LVM_GETITEMCOUNT As Long = 4100 ' получаем количество иконнок
'Const LVM_REDRAWITEMS As Long = 4117 ' перерисовываем иконки
Const CLR_NONE = &HFFFFFFFF
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function InvalidateRect Lib "user32" (ByVal hWnd As Long, lpRect As Any, ByVal bErase As Long) As Long
Private Declare Function UpdateWindow Lib "user32" (ByVal hWnd As Long) As Long
Private Sub Form_Load()
Dim itm As ListItem
Dim col As ColumnHeader
Dim SLV As Long ' хэндл SysListView32
Dim c As Long
Dim IconCount As Integer
Set col = ListView.ColumnHeaders.Add(, , "1")
Set col = ListView.ColumnHeaders.Add(, , "1")
Set itm = ListView.ListItems.Add(, , "FDaSFA")
Set itm = ListView.ListItems.Add(, , "FDaSFA")
Set itm = ListView.ListItems.Add(, , "FDaSFA")
Set itm = ListView.ListItems.Add(, , "FDaSFA")
Set itm = ListView.ListItems.Add(, , "FDaSFA")
SLV = ListView.hWnd
c = SendMessage(SLV, LVM_SETTEXTBKCOLOR, 0, &HEBEBEB) ' шлем месагу на замену цвета
IconCount = SendMessage(SLV, LVM_GETITEMCOUNT, 0, 0) ' получаем количество итемов..
c = SendMessage(SLV, LVM_REDRAWITEMS, 0, IconCount - 1) 'перерисовали
c = SendMessage(SLV, LVM_UPDATE, 1, 0) 'шлем сообщение на апдейт
End Sub
... И почему зеленым ....?