Function Reference


_GUICtrlListView_SetColumnWidth

Changes the width of a column

#include <GuiListView.au3>
_GUICtrlListView_SetColumnWidth ( $hWnd, $iCol, $iWidth )

Parameters

$hWnd Control ID/Handle to the control
$iCol 0-based index of a valid column. For list-view mode, this parameter must be set to zero
$iWidth New width of the column, in pixels.
For report-view mode, the following special values are supported:
    $LVSCW_AUTOSIZE - Automatically sizes the column.
    $LVSCW_AUTOSIZE_USEHEADER - Automatically sizes the column to fit the header text.
If you use this value with the last column, its width is set to fill the remaining width of the list-view control.

Return Value

Success: True.
Failure: False.

Related

_GUICtrlListView_GetColumnWidth, _GUICtrlListView_HideColumn

Example

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    Local $idListview

    GUICreate("ListView Set Column Width", 400, 300)
    $idListview = GUICtrlCreateListView("Column 1|Column 2|Column 3|Column 4", 2, 2, 394, 268)
    GUISetState(@SW_SHOW)

    ; Change column 1 width
    MsgBox($MB_SYSTEMMODAL, "Information", "Column 1 Width: " & _GUICtrlListView_GetColumnWidth($idListview, 0))
    _GUICtrlListView_SetColumnWidth($idListview, 0, 150)
    MsgBox($MB_SYSTEMMODAL, "Information", "Column 1 Width: " & _GUICtrlListView_GetColumnWidth($idListview, 0))

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    GUIDelete()
EndFunc   ;==>Example