Function Reference

_GUICtrlListView_GetGroupRect

指定されたグループの長方形を取得します。

#Include <GuiListView.au3>
_GUICtrlListView_GetGroupRect($hWnd, $iGroupID[, $iGet = $LVGGR_GROUP])

 

パラメータ

$hWnd コントロールのハンドル
$iGroupID 情報を取得されるグループを指定するID
$iGet [オプション]取得する長方形座標を指定するフラグ。次のいずれかです:
  $LVGGR_GROUP - 展開されたグループ全体の座標
  $LVGGR_HEADER - ヘッダーの座標のみ(展開されていないグループ)
  $LVGGR_LABEL - ラベルの座標のみ
  $LVGGR_SUBSETLINK - サブセットリンクの座標のみ(マークアップサブセット)

 

返し値

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

 

注意

必須OS: Windows Vista以降

 

関連

 


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

Opt('MustDeclareVars', 1)

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

_Main()

Func _Main()
    Local $aInfo, $hImage, $hListView
   
    GUICreate("ListView Get Group Info", 400, 300)

    $hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
    GUISetState()

    ; 画像をロード
    $hImage = _GUIImageList_Create()
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0xFF0000, 16, 16))
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x00FF00, 16, 16))
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x0000FF, 16, 16))
    _GUICtrlListView_SetImageList($hListView, $hImage, 1)

    ; 列を追加
    _GUICtrlListView_AddColumn($hListView, "Column 1", 100)
    _GUICtrlListView_AddColumn($hListView, "Column 2", 100)
    _GUICtrlListView_AddColumn($hListView, "Column 3", 100)

    ; アイテムを追加
    _GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
    _GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
    _GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
    _GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
    _GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
    _GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)

    ; グループを作成
    _GUICtrlListView_EnableGroupView($hListView)
    _GUICtrlListView_InsertGroup($hListView, -1, 1, "Group 1", 1)
    _GUICtrlListView_InsertGroup($hListView, -1, 2, "Group 2")
    _GUICtrlListView_SetItemGroupID($hListView, 0, 1)
    _GUICtrlListView_SetItemGroupID($hListView, 1, 2)
    _GUICtrlListView_SetItemGroupID($hListView, 2, 2)

    ; グループID 2の長方形を取得
    $aInfo = _GUICtrlListView_GetGroupRect($hListView, 2)
    MsgBox(4160, "Information", "Rect: " & @LF & _
            @TAB & "Left..: " & $aInfo[0] & @LF & _
            @TAB & "Top...: " & $aInfo[1] & @LF & _
            @TAB & "Right.: " & $aInfo[2] & @LF & _
            @TAB & "Bottom: " & $aInfo[3])

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

    GUIDelete()
EndFunc   ;==>_Main