Function Reference


_GUICtrlListView_GetViewRect

Retrieves the bounding rectangle of all items in the control

#include <GuiListView.au3>
_GUICtrlListView_GetViewRect ( $hWnd )

Parameters

$hWnd Control ID/Handle to the control

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

Remarks

The control must be in icon or small icon view.

Example

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

Example()

Func Example()
        GUICreate("ListView Get View Rect (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_BeginUpdate($idListview)
        For $iI = 1 To 10
                _GUICtrlListView_AddItem($idListview, "Item " & $iI)
        Next
        _GUICtrlListView_EndUpdate($idListview)

        ; Set view
        _GUICtrlListView_SetView($idListview, 3)

        ; Get view rectangle
        Local $aRect = _GUICtrlListView_GetViewRect($idListview)
        MsgBox($MB_SYSTEMMODAL, "Information", StringFormat("View Tile: [%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