Function Reference


_GUICtrlListView_GetItemRectEx

Retrieves the bounding rectangle for all or part of an item

#include <GuiListView.au3>
_GUICtrlListView_GetItemRectEx ( $hWnd, $iIndex [, $iPart = 3] )

Parameters

$hWnd Control ID/Handle to the control
$iIndex 0-based index of the item
$iPart [optional] The portion of the item to retrieve:
    $LVIR_BOUNDS - Returns the bounding rectangle of the entire item, including the icon and label
    $LVIR_ICON - Returns the bounding rectangle of the icon or small icon
    $LVIR_LABEL - Returns the bounding rectangle of the item text
    $LVIR_SELECTBOUNDS - Returns the union of the $LVIR_ICON and $LVIR_LABEL rectangles, but excludes columns in report view.

Return Value

Returns a $tagRECT structure.

Related

$tagRECT, _GUICtrlListView_GetItemRect

Example

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

Example()

Func Example()
        GUICreate("ListView Get Item Rectangle Ex (v" & @AutoItVersion & ")", 400, 300)
        Local $idListview = GUICtrlCreateListView("", 2, 2, 394, 268)
        GUISetState(@SW_SHOW)

        ; Set ANSI format
;~     _GUICtrlListView_SetUnicodeFormat($idListview, False)

        ; Add columns
        _GUICtrlListView_AddColumn($idListview, "Items", 100)

        ; Add items
        _GUICtrlListView_AddItem($idListview, "Item 1")
        _GUICtrlListView_AddItem($idListview, "Item 2")
        _GUICtrlListView_AddItem($idListview, "Item 3")

        ; Get item 2 rectangle
        Local $tRECT = _GUICtrlListView_GetItemRectEx($idListview, 1)
        MsgBox($MB_SYSTEMMODAL, "Information", StringFormat("Item 2 Rectangle : [%d, %d, %d, %d]", DllStructGetData($tRECT, "Left"), _
                        DllStructGetData($tRECT, "Top"), DllStructGetData($tRECT, "Right"), DllStructGetData($tRECT, "Bottom")))

        ; Loop until the user exits.
        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE
        GUIDelete()
EndFunc   ;==>Example