函数参考

_GUIImageList_Create

Create an ImageList control

#Include <GuiImageList.au3>
_GUIImageList_Create([$iCX=16[, $iCY=16[, $iColor=4[, $iOptions=0[, $iInitial=4[, $iGrow=4]]]]]])

 

参数

$iCX [可选参数] Width, in pixels, of each image
$iCY [可选参数] Height, in pixels, of each image
$iColor [可选参数] 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 [可选参数] 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 [可选参数] Number of images that the image list initially contains
$iGrow [可选参数] 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: Handle to the new control
Failure: 0

 

注意/说明

None.

 

相关

_GUIImageList_Destroy

 

示例/演示


#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
    Local $listview, $hImage
    Local $exStyles = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)
   
    GUICreate("ImageList Create", 400, 300)
    $listview = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
    _GUICtrlListView_SetExtendedListViewStyle($listview, $exStyles)
    GUISetState()
   
    ; Load images
    $hImage = _GUIImageList_Create(11, 11)
    _GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap(GUICtrlGetHandle($listview), 0xFF0000, 11, 11))
    _GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap(GUICtrlGetHandle($listview), 0x00FF00, 11, 11))
    _GUIImageList_Add($hImage, _WinAPI_CreateSolidBitmap(GUICtrlGetHandle($listview), 0x0000FF, 11, 11))
    _GUICtrlListView_SetImageList($listview, $hImage, 1)

    ; Add columns
    _GUICtrlListView_AddColumn($listview, "Items", 120)

    ; Add items
    _GUICtrlListView_AddItem($listview, "Item 1", 0)
    _GUICtrlListView_AddItem($listview, "Item 2", 1)
    _GUICtrlListView_AddItem($listview, "Item 3", 2)

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>_Main