# Re: List View 可否让选到的该列整列反白 ?

Posted by tester on June 04, 1998 at 00:55:15:

In Reply to: List View 可否让选到的该列整列反白 ? posted by Eric on May 27, 1998 at 07:00:49:

: 当 List View 有多栏位时(SubItem) 只有第一栏可点选且只有第一栏会反白
: 但我想要该列 任何栏位皆可点且整列反白,可能吗 ?
: vb6.0(sp3)
: Win95 (95a)
使用API
'Full_Row Selection In ListView Control
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 Const LVS_EX_FULLROWSELECT = &H20
Private Const LVM_FIRST = &H1000
Private Const LVM_GETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 53
Private Const LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54

Private Sub FullRowSelect(lvControl As ListView, ByVal status As Boolean)
Dim lvStyle As Long
Dim x As Long
x = SendMessage(lvControl.hwnd, LVM_GETEXTENDEDLISTVIEWSTYLE, 0&, ByVal lvStyle)
If status Then
lvStyle = lvStyle Or LVS_EX_FULLROWSELECT
Else
lvStyle = lvStyle - (lvStyle And LVS_EX_FULLROWSELECT)
End If
x = SendMessage(lvControl.hwnd, LVM_SETEXTENDEDLISTVIEWSTYLE, 0&, ByVal lvStyle)
End Sub

Follow Ups: