Listviewstyle als Miniaturansicht

  • Hallo,

    weiß jemand wie ich so eine Listview hinbekommen kann? :

    [Blockierte Grafik: http://download.lima-city.de/deepred/Bilder/701077783667683935.png]

    Und mein Script bisher:

    [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <GuiListView.au3>
    #include <GuiImageList.au3>

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

    $Form1 = GUICreate("Form1", 600, 350)

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

    $hListView = GUICtrlCreateListView("", 0, 0, 600, 350)
    _GUICtrlListView_SetUnicodeFormat($hListView, False)
    GUICtrlSetStyle($hListView, $LVS_ICON)
    GUISetState(@SW_SHOW)

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

    ; Load images
    $hImage = _GUIImageList_Create(48, 48, 5, 1) ; Icons 32x32, Farbtiefe 5: 32bit, 1: verwende Transparenz)
    _GUIImageList_AddIcon($hImage, "Ordner.ico", 0, True)
    _GUIImageList_AddIcon($hImage, "Ordner.ico", 0, True)
    _GUIImageList_AddIcon($hImage, "Ordner.ico", 0, True); in hImage ordner.ico, Index 0, das Große Icon (32x32) einfügen
    _GUICtrlListView_SetImageList($hListView, $hImage, 0)

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

    ; Add items
    _GUICtrlListView_BeginUpdate($hListView)

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

    _GUICtrlListView_AddItem($hListView, "Ordner", 0)
    _GUICtrlListView_AddItem($hListView, "Ordner", 1)
    _GUICtrlListView_AddItem($hListView, "Ordner", 2)

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

    _GUICtrlListView_EndUpdate($hListView)

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

    While 4
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    EndSwitch
    WEnd

    [/autoit]
    • Offizieller Beitrag

    Einfach für den Extended Style vom Listview $LVS_EX_BORDERSELECT nehmen .

    Spoiler anzeigen
    [autoit]

    #cs ----------------------------------------------------------------------------

    AutoIt Version: 3.3.0.0
    Author: myName

    Script Function:
    Template AutoIt script.

    #ce ----------------------------------------------------------------------------

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

    ; Script Start - Add your code below here

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

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <GuiListView.au3>
    #include <GuiImageList.au3>

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

    $Form1 = GUICreate("Form1", 600, 350)

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

    $hListView = GUICtrlCreateListView("", 0, 0, 600, 350 )
    _GUICtrlListView_SetUnicodeFormat($hListView, False)
    GUICtrlSetStyle($hListView, $LVS_ICON,$LVS_EX_BORDERSELECT)
    GUISetState(@SW_SHOW)

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

    ; Load images
    $hImage = _GUIImageList_Create(48, 48, 5, 1) ; Icons 32x32, Farbtiefe 5: 32bit, 1: verwende Transparenz)
    _GUIImageList_AddIcon($hImage, "Ordner.ico", 0, True)
    _GUIImageList_AddIcon($hImage, "Ordner.ico", 0, True)
    _GUIImageList_AddIcon($hImage, "Ordner.ico", 0, True); in hImage ordner.ico, Index 0, das Große Icon (32x32) einfügen
    _GUICtrlListView_SetImageList($hListView, $hImage, 0)

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

    ; Add items
    _GUICtrlListView_BeginUpdate($hListView)

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

    _GUICtrlListView_AddItem($hListView, "Ordner", 0)
    _GUICtrlListView_AddItem($hListView, "Ordner", 1)
    _GUICtrlListView_AddItem($hListView, "Ordner", 2)

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

    _GUICtrlListView_EndUpdate($hListView)

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

    While 4
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    EndSwitch
    WEnd

    [/autoit]
  • _GUIImageList_AddIcon nimmt nur 16x16 oder 32x32-icons. Größere Icons werden nicht geladen.
    //Edit: Dafür musst du _WInAPI_LoadImage verwenden. Für .ico-Dateien geht es so, für .exe und .dll musst du auch _WinAPI_LoadLibraryEx und so verwenden.

    Spoiler anzeigen
    [autoit]

    #cs ----------------------------------------------------------------------------

    AutoIt Version: 3.3.0.0
    Author: myName

    Script Function:
    Template AutoIt script.

    #ce ----------------------------------------------------------------------------

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

    ; Script Start - Add your code below here

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

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <Constants.au3>
    #include <GuiListView.au3>
    #include <GuiImageList.au3>

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

    $Form1 = GUICreate("Form1", 600, 350)

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

    $hListView = GUICtrlCreateListView("", 0, 0, 600, 350 )
    _GUICtrlListView_SetUnicodeFormat($hListView, False)
    GUICtrlSetStyle($hListView, $LVS_ICON,$LVS_EX_BORDERSELECT)
    GUISetState(@SW_SHOW)

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

    ; Load images
    $hImage = _GUIImageList_Create(48, 48, 5, 1) ; Icons 32x32, Farbtiefe 5: 32bit, 1: verwende Transparenz)
    _GUIImageList_AddIconSize($hImage, "C:\Vista.ico", 48)
    _GUIImageList_AddIconSize($hImage, "C:\Vista.ico", 48)
    _GUIImageList_AddIconSize($hImage, "C:\Vista.ico", 48); in hImage ordner.ico, Index 0, das Große Icon (32x32) einfügen
    _GUICtrlListView_SetImageList($hListView, $hImage, 0)

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

    ; Add items
    _GUICtrlListView_BeginUpdate($hListView)

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

    _GUICtrlListView_AddItem($hListView, "Ordner", 0)
    _GUICtrlListView_AddItem($hListView, "Ordner", 1)
    _GUICtrlListView_AddItem($hListView, "Ordner", 2)

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

    _GUICtrlListView_EndUpdate($hListView)

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

    While 4
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit
    EndSwitch
    WEnd

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

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _GUIImageList_AddIcon
    ; Description ...: Adds an icon to an image list
    ; Syntax.........: _GUIImageList_AddIcon($hWnd, $sFile[, $iIndex=0[, $fLarge = False])
    ; Parameters ....: $hWnd - Handle to the control
    ; $sFile - Path to the icon that contains the image
    ; $iIndex - Specifies the zero-based index of the icon to extract
    ; $fLarge - Extract Large Icon
    ; Return values .: Success - The index of the image
    ; Failrue - -1
    ; Author ........: Paul Campbell (PaulIA)
    ; Modified.......: Prog@ndy
    ; Remarks .......:
    ; Related .......: _GUIImageList_Add, _GUIImageList_AddBitmap
    ; Link ..........;
    ; Example .......; Yes
    ; ===============================================================================================================================
    Func _GUIImageList_AddIconSize($hWnd, $sFile, $iSize=64)
    Local $tIcon, $iResult, $hIcon

    $hIcon = _WinAPI_LoadImage(0,$sFile,$IMAGE_ICON,$iSize,$iSize,$LR_LOADFROMFILE)
    _WinAPI_Check("_GUIImageList_AddIcon", ($hIcon = 0), -1)

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

    $iResult = _GUIImageList_ReplaceIcon($hWnd, -1, $hIcon)
    _WinAPI_Check("_GUIImageList_AddIcon", ($iResult = -1), -2)
    _WinAPI_DestroyIcon($hIcon)
    Return $iResult
    EndFunc ;==>_GUIImageList_AddIcon

    [/autoit]

    Einmal editiert, zuletzt von progandy (7. Februar 2009 um 16:18)

  • Nein, nur Icons. Aber man kann die gewünschte Größe angeben.
    Für Bitmaps gibtes aber andere Funktionen für die ImageList. Die kann man dafür verwenden.