Fügt ein Bitmap einer Imagelist hinzu
#include <GuiImageList.au3>
_GUIImageList_AddBitmap ( $hWnd, $sImage [, $sMask = ""] )
$hWnd | Handle des Controls |
$sImage | Pfad zu dem Bitmap, welches das Bild enthält |
$sMask | [optional] Pfad zu dem Bitmap, welches die Maske enthält |
Erfolg: | Der Index des Bildes |
Fehler: | -1 |
- - - - - - - - Erklärung der Controls - - - - - - - -
_GUIImageList_Add, _GUIImageList_AddIcon
#include <GUIConstantsEx.au3>
#include <GuiImageList.au3>
#include <GuiListView.au3>
#include <WindowsConstants.au3>
Example()
Func Example()
Local $idListview, $hImage
Local $sWow64 = ""
If @OSArch = "X64" Then $sWow64 = "\Wow6432Node"
Local $sPath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $sWow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\Examples\GUI\Advanced\Images\"
GUICreate("Imagelist: AddBitmap", 400, 300)
$idListview = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT))
_GUICtrlListView_SetExtendedListViewStyle($idListview, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER))
GUISetState(@SW_SHOW)
; Lädt die Bilder
$hImage = _GUIImageList_Create(16, 32)
_GUIImageList_AddBitmap($hImage, $sPath & "Red.bmp")
_GUIImageList_AddBitmap($hImage, $sPath & "Green.bmp")
_GUIImageList_AddBitmap($hImage, $sPath & "Blue.bmp")
_GUICtrlListView_SetImageList($idListview, $hImage, 1)
; Fügt die Spalten hinzu
_GUICtrlListView_AddColumn($idListview, "Items", 120)
; Fügt die Items hinzu
_GUICtrlListView_AddItem($idListview, "Item 1", 0)
_GUICtrlListView_AddItem($idListview, "Item 2", 1)
_GUICtrlListView_AddItem($idListview, "Item 3", 2)
; Die Schleife wiederholt sich, bis der Benutzer die Beenden-Aktion der GUI auslöst.
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example