函数参考


_GUIImageList_GetImageInfoEx

返回关于图像的信息

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

参数

$hWnd 控件句柄
$iIndex 图像索引

返回值

成功: 返回关于图像信息的 $tagIMAGEINFO 数据结构
失败: 返回 0

注意/说明

None.

相关

$tagIMAGEINFO

示例/演示


#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <GuiImageList.au3>

Global $iMemo

_Main()

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

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

    ; 加载图像
    $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))

    ; 描绘图像
    $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)

    ; 显示第二个图像的信息
    $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"))

    ; 循环直到用户退出
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>_Main

; 写入一行到 memo 控件
Func MemoWrite($sMessage)
    GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite