イメージリスト内の画像の数を取得します。
#Include <GuiImageList.au3>
_GUIImageList_GetImageCount($hWnd)
パラメータ
$hWnd | コントロールのハンドル |
返し値
画像の数を返します。
注意
なし。
関連
_GUIImageList_SetImageCount
例
#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>
Opt('MustDeclareVars', 1)
_Main()
Func _Main()
Local $listview, $hImage, $iRandom
Local $exStyles = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)
GUICreate("ImageList Get Image Count", 400, 300)
$listview = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
_GUICtrlListView_SetExtendedListViewStyle($listview, $exStyles)
GUISetState()
; 画像をロード
$hImage = _GUIImageList_Create(16, 16, 5, 3)
$iRandom = Random(6, 20, 1)
For $x = 1 To $iRandom
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", $x)
Next
_GUICtrlListView_SetImageList($listview, $hImage, 1)
; 列を追加
_GUICtrlListView_AddColumn($listview, "Column 1", 120)
_GUICtrlListView_AddColumn($listview, "Column 2", 100)
_GUICtrlListView_AddColumn($listview, "Column 3", 100)
; アイテムを追加
_GUICtrlListView_AddItem($listview, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($listview, 0, "Row 1: Col 2", 1, 1)
_GUICtrlListView_AddSubItem($listview, 0, "Row 1: Col 3", 2, 2)
_GUICtrlListView_AddItem($listview, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($listview, 1, "Row 2: Col 2", 1, 2)
_GUICtrlListView_AddItem($listview, "Row 3: Col 1", 2)
_GUICtrlListView_AddItem($listview, "Row 4: Col 1", 3)
_GUICtrlListView_AddItem($listview, "Row 5: Col 1", 4)
_GUICtrlListView_AddSubItem($listview, 4, "Row 5: Col 2", 1, 3)
_GUICtrlListView_AddItem($listview, "Row 6: Col 1", 5)
_GUICtrlListView_AddSubItem($listview, 5, "Row 6: Col 2", 1, 4)
_GUICtrlListView_AddSubItem($listview, 5, "Row 6: Col 3", 2, 3)
MsgBox(4096, "Information", "Image Count: " & _GUIImageList_GetImageCount($hImage))
; ユーザーが終了するまでループ
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main