# Function Reference

# _GUICtrlListView_SetIconSpacing

Sets the spacing between icons where the style is large icon

#include <GuiListView.au3>
_GUICtrlListView_SetIconSpacing ( $hWnd, $iCX, $iCY )

## Parameters

$hWnd | Control ID/Handle to the control
$iCX | Distance, in pixels, to set between icons on the x-axis
$iCY | Distance, in pixels, to set between icons on the y-axis

## Return Value

Returns an array with the following format:
[0] - Previous CX value
[1] - Previous CY value

## Remarks

Values for $iCX and $iCY are relative to the upper-left corner of an icon bitmap. To set spacing between icons that do not overlap, the $iCX or $iCY values must include the size of the icon, plus the amount of empty space desired between icons.
Values that do not include the width of the icon will result in overlaps.

## Example

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

    Example()

    Func Example()
        Local $hImage, $idListview

        ; Create GUI
        GUICreate("ListView Set Icon Spacing", 400, 300)
        $idListview = GUICtrlCreateListView("", 2, 2, 394, 268)
        GUICtrlSetStyle($idListview, $LVS_ICON)
        GUISetState(@SW_SHOW)

        ; Load images
        $hImage = _GUIImageList_Create()
        _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($idListview, 0xFF0000, 16, 16))
        _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($idListview, 0x00FF00, 16, 16))
        _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($idListview, 0x0000FF, 16, 16))
        _GUICtrlListView_SetImageList($idListview, $hImage, 0)

        ; Add items
        _GUICtrlListView_AddItem($idListview, "Item 1", 0)
        _GUICtrlListView_AddItem($idListview, "Item 2", 1)
        _GUICtrlListView_AddItem($idListview, "Item 3", 2)

        ; Change item spacing
        MsgBox($MB_SYSTEMMODAL, "Information", "Changing icon spacing")
        _GUICtrlListView_SetIconSpacing($idListview, 32, 32)

        ; Loop until the user exits.
        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE
        GUIDelete()
    EndFunc   ;==>Example