Retrieves the dimensions of images in an image list
#include <GuiImageList.au3>
_GUIImageList_GetIconSizeEx ( $hWnd )
$hWnd | Handle to the imagelist |
_GUIImageList_GetIconHeight, _GUIImageList_GetIconSize, _GUIImageList_GetIconWidth
#include <GUIConstantsEx.au3>
#include <GuiImageList.au3>
#include <WinAPIGdi.au3>
#include <WinAPIGdiDC.au3>
Global $g_idMemo
Example()
Func Example()
Local $hImage, $hGUI, $hDC, $tSize
$hGUI = GUICreate("ImageList Get Icon SizeEx", 400, 300)
$g_idMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New")
GUISetState(@SW_SHOW)
; Load images
$hImage = _GUIImageList_Create(32, 24)
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0xFF0000, 32, 24))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0x00FF00, 32, 24))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap($hGUI, 0x0000FF, 32, 24))
; Draw images
$hDC = _WinAPI_GetDC($hGUI)
_GUIImageList_Draw($hImage, 0, $hDC, 4, 4)
_GUIImageList_Draw($hImage, 1, $hDC, 40, 4)
_GUIImageList_Draw($hImage, 2, $hDC, 76, 4)
_WinAPI_ReleaseDC($hGUI, $hDC)
; Show image list icon size
$tSize = _GUIImageList_GetIconSizeEx($hImage)
MemoWrite("Image width : " & DllStructGetData($tSize, "X"))
MemoWrite("Image height: " & DllStructGetData($tSize, "Y"))
; 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