"Höhere Listviews"

  • Hallo Leute^^,
    ich suche eine Möglichkeit eine Art "höheres" Listview zu erstellen.
    Hier mal ein Beispiel bei einem iPhone:
    [Blockierte Grafik: http://www.darbysieben.com/wp-content/uploads/2008/11/iphone-google-dentists-toronto-list.jpg
    Mir geht es vorallem darum das die einzelnen Spalten größer sind und einen Untertext haben.

    Vielleicht gibt es da ja UDFs oder ähnliches für.

    Danke im Vorraus^^

    Einmal editiert, zuletzt von sumsum (5. Februar 2012 um 21:30)

  • Man soll "Pakete" aus einer Liste anklicken und installieren können, mit einem normalen Listview sieht das ganze allerdings sehr unübersichtlich und gequetscht aus.
    Daher such ich halt sowas in der Art
    [Blockierte Grafik: http://www.hellhost.de/wiki/_media/iphone:cydia-paketverwaltung.png?cache=&w=320&h=480]

    Mir geht es nicht um die Sortierung und so sondern wirklich nur darum das die einzelnen Items dicker sind und vielleicht sogar noch ein Icon haben können.

  • Ein ListBox Control würde sich hier anbieten.
    Via OwnerDraw zeichnet man die Items dann selber

    Bei diesem Beispiel hab ich die Items als GDIPlus Bitmaps erstellt
    d.H. Die Items können mit dem ganzen Funtionsumfang von GDI+ gestaltet werden - und das ist ne Menge ;)

    Spoiler anzeigen
    [autoit]

    #include <GDIPlus.au3>
    #include <GUIConstantsEx.au3>
    #include <GuiListBox.au3>
    #include <ListBoxConstants.au3>
    #include <WindowsConstants.au3>

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

    Opt("GUIOnEventMode", 1)

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

    Global Const $ODT_LISTBOX = 2
    Global Const $ODA_DRAWENTIRE = 0x1
    Global Const $ODA_SELECT = 0x2
    Global Const $ODS_SELECTED = 0x1
    Global Const $ODA_FOCUS = 0x4

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

    Global Const $ItemHeight = 46
    Global $iLB_Width = 300
    Global $iLB_Height = 400

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

    _GDIPlus_Startup()
    Global $hGUI = GUICreate("Test", $iLB_Width + 20, $iLB_Height + 20)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    Global $hListBox = _GUICtrlListBox_Create($hGUI, "", 10, 10, $iLB_Width, $iLB_Height, BitOR($LBS_NOINTEGRALHEIGHT, $LBS_DISABLENOSCROLL, $WS_VSCROLL, $LBS_HASSTRINGS, $LBS_OWNERDRAWFIXED))
    Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hListBox)

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

    Global $hBrush = _GDIPlus_BrushCreateSolid(0x2000AAFF)
    Global $hPen = _GDIPlus_PenCreate(0x8800FF00, 3)

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

    _GUICtrlListBox_BeginUpdate($hListBox)
    _GUICtrlListBox_SetItemHeight($hListBox, $ItemHeight)
    Global $aItems[1]
    For $i = 1 To 30
    _CreateListBoxItem($aItems, $hListBox, "String " & $i, "Substring" & $i)
    Next
    _GUICtrlListBox_EndUpdate($hListBox)

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

    GUIRegisterMsg($WM_DRAWITEM, "WM_DRAWITEM")

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

    GUISetState()

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

    While Sleep(100)
    WEnd

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

    Func _Exit()
    For $i = 0 To UBound($aItems) - 1
    _GDIPlus_BitmapDispose($aItems[$i])
    Next
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_Shutdown()
    Exit
    EndFunc ;==>_Exit

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

    Func _CreateListBoxItem(ByRef $aItems, $hListBox, $sString, $sSubString)
    Local $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iLB_Width, $ItemHeight, $hGraphics)
    Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($hContext, 2)

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

    Local $iIndex = _GUICtrlListBox_AddString($hListBox, $sString)

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

    _GDIPlus_GraphicsClear($hContext, 0xFFFFFFFF)
    _GDIPlus_GraphicsDrawString($hContext, $sString, 10, 0, "Arial", 14)
    _GDIPlus_GraphicsDrawString($hContext, $sSubString, 80, 25, "Arial", 10)

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

    Local $hPen = _GDIPlus_PenCreate(0xFF0000FF, 2)
    Local $hBrush = _GDIPlus_BrushCreateSolid(0xFFFFFF00)
    _GDIPlus_GraphicsFillRect($hContext, 10, 25, 15, 15, $hBrush)
    _GDIPlus_GraphicsDrawRect($hContext, 10, 25, 15, 15, $hPen)

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

    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_GraphicsDispose($hContext)

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

    If UBound($aItems) <= $iIndex Then ReDim $aItems[$iIndex + 1]
    $aItems[$iIndex] = $hBitmap
    EndFunc ;==>_CreateListBoxItem

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

    Func WM_DRAWITEM($hWnd, $Msg, $wParam, $lParam)
    Local $tDrawItem = DllStructCreate("uInt CtrlType; uInt CtrlID; uInt ItemID; uInt Action; uInt State; hWnd ItemHWND; hWnd hDC; Long Rect[4]; Ptr Data;", $lParam)

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

    Local $iAction = DllStructGetData($tDrawItem, "Action")
    Local $iIndex = DllStructGetData($tDrawItem, "ItemID")
    Local $iX = DllStructGetData($tDrawItem, "Rect", 1)
    Local $iY = DllStructGetData($tDrawItem, "Rect", 2)

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

    Switch $iAction
    Case $ODA_DRAWENTIRE, $ODA_SELECT
    _GDIPlus_GraphicsDrawImage($hGraphics, $aItems[$iIndex], $iX, $iY)

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

    If ($iAction = $ODA_SELECT) And (DllStructGetData($tDrawItem, "State") = $ODS_SELECTED) Then
    Local $iW = DllStructGetData($tDrawItem, "Rect", 3) - $iX
    Local $iH = DllStructGetData($tDrawItem, "Rect", 4) - $iY
    _GDIPlus_GraphicsFillRect($hGraphics, $iX + 3, $iY + 3, $iW - 7, $iH - 7, $hBrush)
    _GDIPlus_GraphicsDrawRect($hGraphics, $iX + 3, $iY + 3, $iW - 7, $iH - 7, $hPen)
    EndIf
    EndSwitch

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

    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_DRAWITEM

    [/autoit]

    E