
Highlighting a Entire row in list view with Report view as its style
Karthik,
Quote:
>Highlighting the entire row in a list view when its style is Reportview.
>Any idea on how to do this.
Yeah, the code follows. Note, however, that this code does not work on the
original version of the common controls. All users using programs that
implement this code need a newer version of them.
--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com
<<<<<<<<<<<<<<<<<<
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA"
(ByVal hwnd As Long, ByVal Msg As Long, ByVal wParam As Long, lParam As Any)
As Long
Private Const LVM_FIRST = &H1000
Private Const LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54
Private Const LVM_GETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 55
Private Const LVS_EX_FULLROWSELECT = &H20
Private Sub Form_Load()
Dim i As Integer
Dim itm As ListItem
Dim dwStyle As Long
'Report view
ListView1.View = lvwReport
'Add a couple of columns
ListView1.ColumnHeaders.Add , , "Column 1"
ListView1.ColumnHeaders.Add , , "Column 2"
ListView1.ColumnHeaders.Add , , "Column 3"
'Add some data to the list
For i = 1 To 100
Set itm = ListView1.ListItems.Add(, , "This is item " & CStr(i))
itm.SubItems(1) = "More data"
itm.SubItems(2) = "Still more data"
Next i
'Get current list view style
dwStyle = SendMessage(ListView1.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0,
ByVal 0&)
'Set full row select style bit
dwStyle = dwStyle Or LVS_EX_FULLROWSELECT
'Set new list view style
SendMessage ListView1.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, ByVal
dwStyle
End Sub