Mensaje enviado por "Bracho, Yamil" <brachoy@pdvsa.com>
Yo utilizo la siguiente rutina despues que ha agregado todos los datos al ListView
'---------------------------------
' Utilizadas por AdjustColumnWidth
'---------------------------------
Private Const LVM_SETCOLUMNWIDTH = &H1000 + 30
Private Const LVSCW_AUTOSIZE = -1
Private Const LVSCW_AUTOSIZE_USEHEADER = -2
Public Declare Function SendMessage _
Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Long) As Long
'--------------------------------------------------
' Proposito:
' Ajusta el tamano de las columnas de un ListView
' Entrada:
' LV - Objeto ListView
' AccountForHeader - True si desea tomar en cuenta
' el ancho de los encabezados
' de las columnas
'
' Salida:
' Nada
' Autor Fecha Comentarios
'-------------- ---------- ------------------------
' Yamil Bracho 1/MAY/1999 Version Inicial
'--------------------------------------------------
Public Sub AdjustColumnWidth(LV As ListView, AccountForHeaders As Boolean)
Dim col As Integer
Dim lParam As Long
If AccountForHeaders Then
lParam = LVSCW_AUTOSIZE_USEHEADER
Else
lParam = LVSCW_AUTOSIZE
End If
'------------------------------------
' Send the message to all the columns
'------------------------------------
For col = 0 To LV.ColumnHeaders.Count - 1
SendMessage LV.hwnd, LVM_SETCOLUMNWIDTH, col, ByVal lParam
Next
End Sub
Espero te sirva
Yamil