|
|
|
|
|
Dicas
|
|
Visual Basic (ActiveX/Controles/DLL)
|
|
|
Título da Dica: Auto Redimensionar todos os ListViews de um Form
|
|
|
|
Postada em 14/8/2003 por Danilonofre
'Em um Módulo Escreva 'Procedimento de Auto Redimensionar ListView Private Declare Function SendMessage Lib "user32.dll" _ Alias "SendMessageA" (ByVal hWnd As Long, _ ByVal Msg As Long, ByVal wParam As Long, _ ByVal lParam As Long) As Long Private Const LVM_FIRST = &H1000 Private Const LVM_SETCOLUMNWIDTH = (LVM_FIRST + 30) Private Const LVSCW_AUTOSIZE = -1 Private Const LVSCW_AUTOSIZE_USEHEADER = -2 'Fim dos Procedimentos _____________________________________________________________
'Função para Redimencionar os ListViews Private Function AutoResize(Form As Form) Dim Column As Long Dim Counter As Long Dim ctrl As Object For Each ctrl In Form.Controls If TypeOf ctrl Is ListView Then Counter = 0 For Column = Counter To ctrl.ColumnHeaders.Count - 2 SendMessage ctrl.hWnd, _ LVM_SETCOLUMNWIDTH, _ Column, _ LVSCW_AUTOSIZE_USEHEADER Next End If Next End Function
|
|
|
|
|