Function Reference


_GUIImageList_GetIconSize

Retrieves the dimensions of images in an image list

#include <GuiImageList.au3>
_GUIImageList_GetIconSize ( $hWnd )

Parameters

$hWnd Handle to the imagelist

Return Value

Returns an array with the following format:
    [0] - Width, in pixels, of each image
    [1] - Height, in pixels, of each image

Related

_GUIImageList_GetIconHeight, _GUIImageList_GetIconSizeEx, _GUIImageList_GetIconWidth, _GUIImageList_SetIconSize

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