# Function Reference

# _GUICtrlListView_GetItemRect

Retrieves the bounding rectangle for all or part of an item

#include <GuiListView.au3>
_GUICtrlListView_GetItemRect ( $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 an array with the following format:
[0] - X coordinate of the upper left corner of the rectangle
[1] - Y coordinate of the upper left corner of the rectangle
[2] - X coordinate of the lower right corner of the rectangle
[3] - Y coordinate of the lower right corner of the rectangle

## Related

_GUICtrlListView_GetItemRectEx

## Example

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

    Example()

    Func Example()
        Local $aRect, $idListview

        GUICreate("ListView Get Item Rectangle", 400, 300)
        $idListview = GUICtrlCreateListView("", 2, 2, 394, 268)
        GUISetState(@SW_SHOW)

        ; 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
        $aRect = _GUICtrlListView_GetItemRect($idListview, 1)
        MsgBox($MB_SYSTEMMODAL, "Information", StringFormat("Item 2 Rectangle : [%d, %d, %d, %d]", $aRect[0], $aRect[1], $aRect[2], $aRect[3]))

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