Re : USF recherche de Thierry
Le code de CHTI160 ne fait qu'agrandir la colonne 1 du listview1 mais n'ajuste pas toutes les colonnes.
Je dois surement mal l'adapter dans mon cas:
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 Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As Long) As Long
Private Const LVM_FIRST = &H1000
Private Const LVM_SETCOLUMNWIDTH = LVM_FIRST + 30
Private Const LVSCW_AUTOSIZE = -1
Sub RefreshLV(ListView1 As ListView)
LockWindowUpdate ListView1.Hwnd
Call SendMessage(ListView1.Hwnd, LVM_SETCOLUMNWIDTH, 0, LVSCW_AUTOSIZE)
If ListView1.ColumnHeaders(1).Width < ListView1.Width Then
If ListView1.Height > (ListView1.ListItems.Count * 270) Then
ListView1.ColumnHeaders(1).Width = ListView1.Width - 80
Else
If ListView1.ColumnHeaders(1).Width < ListView1.Width - 320 Then
ListView1.ColumnHeaders(1).Width = ListView1.Width - 320
End If
End If
End If
LockWindowUpdate 0&
End Sub