;-- TIME_STAMP   2017-10-12 17:29:10   v 0.1


#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_AU3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#Region ;************ Includes ************
#include-once
#include <GUIConstantsEx.au3>
;~ #include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <GuiImageList.au3>
#include <_GUIImageList_AddImage.au3>
#include <GuiListView.au3>
;~ #include <WinAPI.au3>
#EndRegion ;************ Includes ************

Opt('MustDeclareVars', 1)

Global $g_hImageList

_GDIPlus_Startup()

Example()

_GDIPlus_Shutdown()

Func Example()
	; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
	; Hier deine Datenbankabfrage machen
	Local $array = [['Wert1...'], ['Wert2...'], ['Wert3...'], ['Bild...']]
	; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

	Local $idListview, $iStylesEx = BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)

	GUICreate("ImageList Add", 568, 748)
	$idListview = GUICtrlCreateListView("Wert1|Wert2|Wert3|Bild", 2, 2, 564, 744, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
	_GUICtrlListView_SetExtendedListViewStyle($idListview, $iStylesEx)
	GUISetState(@SW_SHOW)

	; Load images
	Local $iX = 64, $iY = 64
;~ 	Local $iX = 32, $iY = 32
;~ 	Local $iX = 16, $iY = 16

	; Add images to imagelist
	$g_hImageList = _GUIImageList_Create($iX, $iY, 5)
	For $i = 0 To UBound($array) -1 Step 1
		If FileExists($array[$i][3]) Then
			_GUIImageList_AddImage($g_hImageList, $array[$i][3], $iX, $iY)
			If @error Then ConsoleWrite(StringFormat('! Error: Bild in $array[%i][3] --> "%s" konnte nicht zur ImageList hinzugefügt werden! - @error = %i\r',  $i, $array[$i][3], @error))
		Else
			ConsoleWrite(StringFormat('! Error: Bild in $array[%i][3] --> "%s" konnte nicht gefunden werden!\r',  $i, $array[$i][3]))
		EndIf
	Next
	_GUICtrlListView_SetImageList($idListview, $g_hImageList, 1)

	_GUICtrlListView_SetColumnWidth($idListview, 0, 120)
	_GUICtrlListView_SetColumnWidth($idListview, 1,  80)
	_GUICtrlListView_SetColumnWidth($idListview, 2, 150)
	_GUICtrlListView_SetColumnWidth($idListview, 3, 210)

	_GUICtrlListView_JustifyColumn($idListview, 0, 0) ; Text is left aligned
	_GUICtrlListView_JustifyColumn($idListview, 1, 0) ; Text is left aligned
	_GUICtrlListView_JustifyColumn($idListview, 2, 1) ; Text is right aligned
	_GUICtrlListView_JustifyColumn($idListview, 3, 2) ; Text is centered

	For $i = 0 To UBound($array) -1 Step 1
		; Add items
		_GUICtrlListView_AddItem($idListview, $array[$i][0], -1) ; ohne Bild
		; Add subitems
		_GUICtrlListView_AddSubItem($idListview, $i, $array[$i][1], 1, -1) ; ohne Bild
		_GUICtrlListView_AddSubItem($idListview, $i, $array[$i][2], 2, -1) ; ohne Bild
		_GUICtrlListView_AddSubItem($idListview, $i, $array[$i][3], 3, $i) ; mit Bild
	Next

	; Loop until the user exits.
	Do
	Until GUIGetMsg() = $GUI_EVENT_CLOSE
	GUIDelete()
EndFunc   ;==>Example
