函数参考


_GUICtrlEdit_Scroll

垂直滚动文本

#include <GuiEdit.au3>
_GUICtrlEdit_Scroll($hWnd, $iDirection)

参数

$hWnd 控件的控件ID/句柄
$iDirection 这个参数可以是以下值之一:
$SB_LINEDOWN - 向下滚动一行
$SB_LINEUP - 向上滚动一行
$SB_PAGEDOWN - 向下滚动一页
$SB_PAGEUP - 向上滚动一页
$SB_SCROLLCARET - 滚动插入符号到可见

返回值

成功: 返回值的高序位字为 TRUE
    低序位为滚动行数
失败: 返回 0

注意/说明

参数 $SB_xxxxx 要求 ScrollBarConstants.au3 文件定义常量.

相关

_GUICtrlEdit_LineScroll

示例/演示


#include <GuiEdit.au3>
#include <GuiStatusBar.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ScrollBarConstants.au3>

$Debug_Ed = False ; 检查传递给 Edit 函数的类名, 设置为真并使用另一控件的句柄可以看出它是否有效

_Main()

Func _Main()
    Local $hStatusBar, $hEdit, $hGUI
    Local $sWow64 = ""
    If @AutoItX64 Then $sWow64 = "\Wow6432Node"
    Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE" & $sWow64 & "\AutoIt v3\AutoIt", "InstallDir") & "\include\_ReadMe_.txt"
    Local $aPartRightSide[3] = [200, 378, -1], $iLen

    ; 创建 GUI
    $hGUI = GUICreate("Edit Scroll", 400, 300)
    $hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268, BitOR($ES_WANTRETURN, $WS_VSCROLL))
    $hStatusBar = _GUICtrlStatusBar_Create($hGUI, $aPartRightSide)
    _GUICtrlStatusBar_SetIcon($hStatusBar, 2, 97, "shell32.dll")
    GUISetState()

    ; 设置边距
    _GUICtrlEdit_SetMargins($hEdit, BitOR($EC_LEFTMARGIN, $EC_RIGHTMARGIN), 10, 10)

    ; 设置文本
    _GUICtrlEdit_SetText($hEdit, FileRead($sFile))

    MsgBox(4160, "信息", "Scroll Line Down")
    _GUICtrlEdit_Scroll($hEdit, $SB_LINEDOWN)

    MsgBox(4160, "信息", "Scroll Line Up")
    _GUICtrlEdit_Scroll($hEdit, $SB_LINEUP)

    MsgBox(4160, "信息", "Scroll Page Down")
    _GUICtrlEdit_Scroll($hEdit, $SB_PAGEDOWN)

    MsgBox(4160, "信息", "Scroll Page Up")
    _GUICtrlEdit_Scroll($hEdit, $SB_PAGEUP)

    $iLen = _GUICtrlEdit_GetTextLen($hEdit)
    _GUICtrlEdit_SetSel($hEdit, $iLen, $iLen)

    MsgBox(4160, "信息", "Scroll Caret")
    _GUICtrlEdit_Scroll($hEdit, $SB_SCROLLCARET)

    ; 循环直到用户退出
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>_Main