Local $hImage, $hListView
; Create GUI
GUICreate("ListView Set Icon Spacing", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUICtrlSetStyle($hListView, $LVS_ICON)
GUISetState()
; Load images
$hImage = _GUIImageList_Create()
_GUIImageList_SetIconSize($hImage,32,32)
_GUIImageList_SetBkColor($hImage,0xffffff)
_GUIImageList_AddIcon($hImage, "002.ico") ;读取图标
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 48, 48))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 48, 48))
_GUICtrlListView_SetImageList($hListView, $hImage, 0)
; Add items
_GUICtrlListView_AddItem($hListView, "Item 1", 0)
_GUICtrlListView_AddItem($hListView, "Item 2", 1)
_GUICtrlListView_AddItem($hListView, "Item 3", 2)
; Change item spacing
;MsgBox(4160, "Information", "Changing icon spacing")
_GUICtrlListView_SetIconSpacing($hListView, 64, 64)
; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete() |