|
|
Title | Give a ListView control flat headers |
Description | This example shows how to give a ListView control flat headers in Visual Basic 6. It uses the SetWindowLong API function to remove the HDS_BUTTONS style from the control. |
Keywords | ListView, header, flat header |
Categories | Controls, Tips and Tricks |
|
|
Thanks to Dipak Auddy.
Subroutine SetFlatHeaders uses SendMessage to get a handle to the ListView's header. It uses GetWindowLong to get the header's style, clears the HDS_BUTTONS style bit, and then uses SetWindowLong to set the header's new style.
|
|
' Give the ListView a flat header style.
Private Sub SetFlatHeaders(ByVal lvw As ListView)
Dim lv_hwnd As Long
Dim hHeader As Long
Dim Style As Long
' Get the handle to the listview header
lv_hwnd = lvw.hwnd
hHeader = SendMessage(lv_hwnd, LVM_GETHEADER, 0, ByVal _
0&)
' Set the new style
Style = GetWindowLong(hHeader, GWL_STYLE)
Style = Style And Not HDS_BUTTONS
SetWindowLong hHeader, GWL_STYLE, Style
End Sub
|
|
|
|
|
|