Hej alla glada programmerare! Detta kanske kan vara till någon hjälp?Listview -platta columnheaders
Hoppas att det går bra för er, jag har ett problem med en Listview kontroll som jag vill ha platta columnheaders på, fungerade med API för ett tag sen (Vb 6.0) men har tappat bort koden.
Vi ses.Sv: Listview -platta columnheaders
<code>
Private Declare Function SendMessage Lib "User32" Alias "SendMessageA" _
(ByVal hWnd As Long, ByVal uMsg As Long, _
ByVal wParam As Long, lParam As Any) As Long
Private Declare Function SetWindowPos Lib "User32" _
(ByVal hWnd As Long, ByVal hWndInsertAfter As Long, _
ByVal x As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, _
ByVal wFlags As Long) As Long
Private Declare Function GetWindowLong Lib "User32" Alias "GetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "User32" Alias "SetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long, ByVal wdNewLong As Long) As Long
Private Const LVM_FIRST As Long = &H1000
Private Const LVM_GETHEADER As Long = (LVM_FIRST + 31)
Private Const GWL_STYLE As Long = (-16)
Private Const SWP_DRAWFRAME As Long = &H20
Private Const SWP_NOMOVE As Long = &H2
Private Const SWP_NOSIZE As Long = &H1
Private Const SWP_NOZORDER As Long = &H4
Private Const SWP_FLAGS As Long = SWP_NOZORDER Or _
SWP_NOSIZE Or _
SWP_NOMOVE Or _
SWP_DRAWFRAME
Private Const HDS_BUTTONS As Long = &H2
Private Sub Form_Load()
ListView1.Move ScalLeft, ScaleTop, ScaleWidth, ScaleHeight
Dim lngStyle As Long, lngHeader As Long
lngHeader = SendMessage(ListView1.hWnd, LVM_GETHEADER, 0, ByVal &O0)
lngStyle = GetWindowLong(lngHeader, GWL_STYLE)
lngStyle = lngStyle Xor HDS_BUTTONS
If lngStyle Then
Call SetWindowLong(lngHeader, GWL_STYLE, lngStyle)
Call SetWindowPos(ListView1.hWnd, Form1.hWnd, 0, 0, 0, 0, SWP_FLAGS)
End If
End Sub
</code>
/Michael