Function Reference

_GUICtrlListView_GetViewRect

コントロール内の全アイテムの外接長方形を取得します。

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

 

パラメータ

$hWnd コントロールのハンドル

 

返し値

次のフォーマットの配列を返します。
        [0] - 長方形の左上隅のX座標
        [1] - 長方形の左上隅のY座標
        [2] - 長方形の右下隅のX座標
        [3] - 長方形の右下隅のY座標

 

注意

コントロールはアイコンまたはスモールアイコン表示でなければなりません。

 

関連

 


#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; ListView関数に渡されるClassNameを調べる。動作を確認するにはTrueを設定し、他のコントロールのハンドルを使用

_Main()

Func _Main()
    Local $aRect, $hListView
   
    GUICreate("ListView Get View Rect", 400, 300)
    $hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
    GUISetState()

    ; 列を追加
    _GUICtrlListView_AddColumn($hListView, "Items", 100)

    ; アイテムを追加
    _GUICtrlListView_BeginUpdate($hListView)
    For $iI = 1 To 10
        _GUICtrlListView_AddItem($hListView, "Item " & $iI)
    Next
    _GUICtrlListView_EndUpdate($hListView)

    ; 表示を設定
    _GUICtrlListView_SetView($hListView, 3)

    ; 表示長方形を取得
    $aRect = _GUICtrlListView_GetViewRect($hListView)
    MsgBox(4160, "Information", StringFormat("View Tile: [%d, %d, %d, %d]", $aRect[0], $aRect[1], $aRect[2], $aRect[3]))

    ; ユーザーが終了するまでループ
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>_Main