Create an ImageList control
#include <GuiImageList.au3>
_GUIImageList_Create ( [$iCX = 16 [, $iCY = 16 [, $iColor = 4 [, $iOptions = 0 [, $iInitial = 4 [, $iGrow = 4]]]]]] )
$iCX | [optional] Width, in pixels, of each image |
$iCY | [optional] Height, in pixels, of each image |
$iColor | [optional] Image color depth: 0 - Use the default behavior 1 - Use a 4 bit DIB section 2 - Use a 8 bit DIB section 3 - Use a 16 bit DIB section 4 - Use a 24 bit DIB section 5 - Use a 32 bit DIB section 6 - Use a device-dependent bitmap |
$iOptions | [optional] Option flags. Can be a combination of the following: 1 - Use a mask 2 - The images in the lists are mirrored 4 - The image list contains a strip of images |
$iInitial | [optional] Number of images that the image list initially contains |
$iGrow | [optional] Number of images by which the image list can grow when the system needs to make room for new images. This parameter represents the number of new images that the resized image list can contain. |
Success: | a handle to the new control. |
Failure: | 0. |
#include <GUIConstantsEx.au3>
#include <GuiImageList.au3>
#include <GuiListView.au3>
#include <WinAPIGdi.au3>
#include <WindowsConstants.au3>
Example()
Func Example()
Local $idListview, $hImage
Local $iStylesEx = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)
GUICreate("ImageList Create", 400, 300)
$idListview = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
_GUICtrlListView_SetExtendedListViewStyle($idListview, $iStylesEx)
GUISetState(@SW_SHOW)
; Load images
$hImage = _GUIImageList_Create(11, 11)
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap(GUICtrlGetHandle($idListview), 0xFF0000, 11, 11))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap(GUICtrlGetHandle($idListview), 0x00FF00, 11, 11))
_GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap(GUICtrlGetHandle($idListview), 0x0000FF, 11, 11))
_GUICtrlListView_SetImageList($idListview, $hImage, 1)
; Add columns
_GUICtrlListView_AddColumn($idListview, "Items", 120)
; Add items
_GUICtrlListView_AddItem($idListview, "Item 1", 0)
_GUICtrlListView_AddItem($idListview, "Item 2", 1)
_GUICtrlListView_AddItem($idListview, "Item 3", 2)
; Loop until the user exits.
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example