MasterEvil
Erfahrenes Mitglied
Kann mir einer sagen wie man bei einem ListView die Spalten fest macht, so das der Anwender die Größe nichtmehr verändern kann?
Schonmal Danke im Vorraus
Schonmal Danke im Vorraus

Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
Private Sub Form_Load()
With Listview1
.View = lvwReport
.ColumnHeaders.Add 1, , "Col1"
.ColumnHeaders.Add 2, , "Col2"
.ColumnHeaders.Add 3, , "Col3"
End With
StartSubClass ListView1.hWnd
End Sub
Private Const HDN_FIRST = (-300)
Private Const HDN_BEGINTRACKA = (HDN_FIRST - 6)
Private Const HDN_BEGINTRACKW = (HDN_FIRST - 26)
Private Const WM_NOTIFY = &H4E
Private Const GWL_WNDPROC = (-4)
'ACHTUNG: Abgewandelte Notity-Struktur
Private Type MyNMHDR
hwndFrom As Long
idFrom As Long
code As Long
iItem As Long
End Type
Private Declare Function CallWindowProc Lib "user32" Alias _
"CallWindowProcA" ( _
Byval lpPrevWndFunc As Long, _
Byval hWnd As Long, _
Byval msg As Long, _
Byval wParam As Long, _
Byval lParam As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias _
"SetWindowLongA" ( _
Byval hWnd As Long, _
Byval nIndex As Long, _
Byval lParam As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias _
"RtlMoveMemory" ( _
ByRef pDest As Any, _
ByRef pSrc As Any, _
Byval ByteLen As Long)
Private hOldWndProc As Long
Sub StartSubClass(Byval hWnd As Long)
hOldWndProc = SetWindowLong(hWnd, GWL_WNDPROC, AddressOf SubClassLV)
End Sub
Sub EndSubClass(Byval hWnd As Long)
SetWindowLong hWnd, GWL_WNDPROC, hOLdWndProc
End Sub
Function SubClassLV(Byval hWnd As Long, Byval message As Long, _
Byval wParam As Long, Byval lParam As Long) As Long
Dim nm As MyNMHDR
If message = WM_NOTIFY Then
CopyMemory Byval nm, Byval lParam, Len(nm)
If nm.code = HDN_BEGINTRACKA Or nm.code = HDN_BEGINTRACKW Then
SubClassLV = True
Exit Function
End If
End If
SubClassLV = CallWindowProc(hOldWndProc, hWnd, message, wParam, Byval lParam)
End Function