Function Reference


_GUIImageList_SetIconSize

Sets the dimensions of images in an image list and removes all images from the list

#include <GuiImageList.au3>
_GUIImageList_SetIconSize ( $hWnd, $iCX, $iCY )

Parameters

$hWnd Handle to the imagelist
$iCX The width, in pixels, of the images in the image list
$iCY The height, in pixels, of the images in the image list

Return Value

Success: True.
Failure: False.

Remarks

All images in an image list have the same dimensions.

Related

_GUIImageList_GetIconSize

Example

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

Global $g_idMemo

Example()

Func Example()
        GUICreate("ImageList Get/Set Icon Size (v" & @AutoItVersion & ")", 400, 300)
        Local $idListview = GUICtrlCreateListView("", 2, 2, 394, 199, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
        $g_idMemo = GUICtrlCreateEdit("", 2, 200, 396, 266, 0)
        GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New")
        GUISetState(@SW_SHOW)

        Local $hImage = _GUIImageList_Create(32, 32, 5, 3)
        _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 110)
        _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 131)
        _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 165)
        _GUICtrlListView_SetImageList($idListview, $hImage, 1)

        ; Add columns
        _GUICtrlListView_AddColumn($idListview, "Column 1", 120)
        _GUICtrlListView_AddColumn($idListview, "Column 2", 100)
        _GUICtrlListView_AddColumn($idListview, "Column 3", 100)

        ; Add items
        _GUICtrlListView_AddItem($idListview, "Row 1: Col 1", 0)
        _GUICtrlListView_AddSubItem($idListview, 0, "Row 1: Col 2", 1, 1)
        _GUICtrlListView_AddSubItem($idListview, 0, "Row 1: Col 3", 2, 2)
        _GUICtrlListView_AddItem($idListview, "Row 2: Col 1", 1)
        _GUICtrlListView_AddSubItem($idListview, 1, "Row 2: Col 2", 1, 2)

        ; Show image list icon size
        Local $aSize = _GUIImageList_GetIconSize($hImage)
        MemoWrite("Image width : " & $aSize[0])
        MemoWrite("Image height: " & $aSize[1])

        MsgBox($MB_SYSTEMMODAL, "Information", "Changing Icon Size")

        _GUIImageList_SetIconSize($hImage, 16, 16)
        _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 110)
        _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 131)
        _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 165)
        _GUICtrlListView_SetImageList($idListview, $hImage, 1)

        $aSize = _GUIImageList_GetIconSize($hImage)
        MemoWrite("Image width : " & $aSize[0])
        MemoWrite("Image height: " & $aSize[1])

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

; Write a line to the memo control
Func MemoWrite($sMessage)
        GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite