listview mit großen icons und label

  • Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>
    #include <GUIListView.au3>

    [/autoit] [autoit][/autoit] [autoit]

    GUICreate('Test ListView', 175, 150)

    [/autoit] [autoit][/autoit] [autoit]

    Opt("GUIOnEventMode", 1)
    GUISetOnEvent($GUI_EVENT_CLOSE, "ExitScript")

    [/autoit] [autoit][/autoit] [autoit]

    Global $listview = GUICtrlCreateListView('Icon', 0, 0, 175, 150)
    GUICtrlSetStyle(-1, $LVS_NOCOLUMNHEADER)

    [/autoit] [autoit][/autoit] [autoit]

    ItemSetup('Recycle Bin', @WindowsDir & '\explorer.exe', 6)
    ItemSetup('Open Folder', @SystemDir & '\shell32.dll', 4)
    ItemSetup('Fixed Drive', @SystemDir & '\shell32.dll', 8)
    ItemSetup('My Computer', @SystemDir & '\shell32.dll', 15)
    ItemSetup('Taskbar/Start menu', @WindowsDir & '\explorer.exe', 5)
    ItemSetup('Desktop', @WindowsDir & '\explorer.exe', 3)

    [/autoit] [autoit][/autoit] [autoit]

    _GUICtrlListView_SetColumnWidth($listview, 0, $LVSCW_AUTOSIZE_USEHEADER)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState()
    While 1
    Sleep(5000)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func ExitScript()
    Exit
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func ListItemRemoveReAdd()
    Local $sel = _GUICtrlListView_GetSelectedIndices($listview, 1)
    Local $txt = _GUICtrlListView_GetItemText($listview, $sel[1])
    _GUICtrlListView_DeleteItem($listview, $sel[1])
    ItemSetup($txt, @SystemDir & '\shell32.dll', 0)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func ItemSetup($name, $icon, $index)
    Local $item = GUICtrlCreateListViewItem($name, $listview)
    Local $menu = GUICtrlCreateContextMenu($item)
    GUICtrlCreateMenuItem("Remove/ReAdd", $menu, -1)
    GUICtrlSetOnEvent(-1, "ListItemRemoveReAdd")
    GUICtrlSetImage($item, $icon, $index)
    EndFunc

    [/autoit]