morgan1991,
Можно еще так поизвращаться
Код:
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <Constants.au3>
GUICreate("", 400, 300)
$ListView = GUICtrlCreateListView("", 10, 10, 380, 280, BitOR($LVS_SHOWSELALWAYS, $LVS_REPORT))
$hListView = GUICtrlGetHandle($ListView)
GUISetState()
_GUICtrlListView_AddColumn($hListView, "Column 1", 50)
For $i = 1 To Random(5, 15, 1)
$sString = ''
For $j = 1 To Random(5, 25, 1)
$sString &= Chr(Random(65, 90, 1))
$sString &= Chr(Random(97, 122, 1))
Next
_GUICtrlListView_AddItem($hListView, $sString)
Next
MsgBox(0, '', 'Подгоняем размеры ListView.')
$iItemCount = _GUICtrlListView_GetItemCount($hListView)
Dim $aItem[$iItemCount]
$iLenMax = 0
$j = 0
For $i = 0 To $iItemCount - 1
$aItem[$i] = _GUICtrlListView_GetItemText($hListView, $i)
$aItemLen = _GUICtrlListView_GetStringWidth($hListView, $aItem[$i])
If $aItemLen > $iLenMax Then
$iLenMax = $aItemLen
EndIf
Next
_GUICtrlListView_SetColumnWidth($hListView, 0, $iLenMax + 10)
$iY = _GUICtrlListView_ApproximateViewHeight($hListView)
$iLeft = Round((400 - $iLenMax - 20) / 2)
_WinAPI_SetWindowPos($hListView, 0, $iLeft, 10, $iLenMax + 20, $iY, $SWP_NOZORDER)
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE