UDF > GUI > GuiImageList >


_GUIImageList_GetImageInfoEx

Obtient des informations sur une image

#include <GuiImageList.au3>
_GUIImageList_GetImageInfoEx ( $hWnd, $iIndex )

Paramètres

$hWnd Handle de la liste d'images
$iIndex Index de l'image

Valeur de retour

Retourne une structure $tagIMAGEINFO avec des informations sur l'image.

En relation

$tagIMAGEINFO

Exemple

#include <GUIConstantsEx.au3>
#include <GuiImageList.au3>
#include <WinAPIGdi.au3>
#include <WinAPIGdiDC.au3>

Global $g_idMemo

Example()

Func Example()
    Local $hImage, $hGUI, $hDC, $tInfo

    $hGUI = GUICreate("ImageList Get Icon InfoEx", 400, 300)
    $g_idMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
    GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New")
    GUISetState(@SW_SHOW)

    ; Charge des 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))

    ; Dessine les 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)

    ; Affiche des informations sur la seconde image
    $tInfo = _GUIImageList_GetImageInfoEx($hImage, 1)
    MemoWrite("Image handle .: 0x" & Hex(DllStructGetData($tInfo, "hBitmap")))
    MemoWrite("Mask handle ..: " & DllStructGetData($tInfo, "hMask"))
    MemoWrite("Image Left ...: " & DllStructGetData($tInfo, "Left"))
    MemoWrite("Image Top ....: " & DllStructGetData($tInfo, "Top"))
    MemoWrite("Image Right ..: " & DllStructGetData($tInfo, "Right"))
    MemoWrite("Image Bottom .: " & DllStructGetData($tInfo, "Bottom"))

    ; Boucle jusqu'à ce que l'utilisateur quitte.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example

; Ecrit une ligne dans le contrôle mémo
Func MemoWrite($sMessage)
    GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite