函数参考


_GUIScrollBars_GetScrollBarRect

检索滚动控件坐标

#Include <GuiScrollBars.au3>
_GUIScrollBars_GetScrollBarRect($hWnd, $idObject)

参数

$hWnd 窗口句柄
$idObject 指定滚动控件对象. 参数可以是以下值之一:
$OBJID_CLIENT - 参数 $hWnd 是滚动控件的窗口句柄.
$OBJID_HSCROLL - $hWnd 窗口的水平滚动控件.
$OBJID_VSCROLL - $hWnd 窗口的垂直滚动控件.

返回值

成功: 返回数组格式如下:
[0] - 左
[1] - 顶
[2] - 右
[3] - 底
失败: 设置@error:

注意/说明

 以上常数需要 ScrollBarConstants.au3

相关

_GUIScrollBars_GetScrollBarInfoEx

示例/演示


#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiScrollBars.au3>
#include <ScrollBarConstants.au3>

Global $iMemo

_Main()

Func _Main()
    Local $GUIMsg, $hGUI, $aRect

    $hGUI = GUICreate("ScrollBar Example", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
    $iMemo = GUICtrlCreateEdit("", 2, 2, 380, 360, BitOR($WS_HSCROLL, $WS_VSCROLL))
    GUICtrlSetResizing($iMemo, $GUI_DOCKALL)
    GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
    GUISetBkColor(0x88AABB)

    GUISetState()

    _GUIScrollBars_Init($hGUI)

    $aRect = _GUIScrollBars_GetScrollBarRect($hGUI, $OBJID_HSCROLL)
    MemoWrite("Horizontal" & @CRLF & "--------------------------------------")
    MemoWrite("Left.........: " & $aRect[0])
    MemoWrite("Top..........: " & $aRect[1])
    MemoWrite("Right........: " & $aRect[2])
    MemoWrite("Bottom.......: " & $aRect[3])

    $aRect = _GUIScrollBars_GetScrollBarRect($hGUI, $OBJID_VSCROLL)
    MemoWrite(@CRLF & "--------------------------------------" & @CRLF & "Vertical" & @CRLF & "--------------------------------------")
    MemoWrite("Left.........: " & $aRect[0])
    MemoWrite("Top..........: " & $aRect[1])
    MemoWrite("Right........: " & $aRect[2])
    MemoWrite("Bottom.......: " & $aRect[3])


    While 1
        $GUIMsg = GUIGetMsg()

        Switch $GUIMsg
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd

    Exit
EndFunc   ;==>_Main

; 写入一行到 memo 控件
Func MemoWrite($sMessage)
    GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite