启用/禁用滚动控件
#Include <GuiScrollBars.au3>
_GUIScrollBars_EnableScrollBar($hWnd[, $wSBflags = $SB_BOTH[, $wArrows = $ESB_ENABLE_BOTH]])
$hWnd | 窗口句柄 |
$wSBflags | [可选参数] 滚动控件类型.参数可以是以下值之一 $SB_BOTH - 启用或禁用水平和垂直滚动的箭头. $SB_CTL - 滚动是一个控件.$hWnd 必须是滚动控件的窗口句柄. $SB_HORZ - 启用或禁用水平滚动箭头. $SB_VERT - 启用或禁用垂直滚动箭头. |
$wArrows | [可选参数] 指定水平和垂直滚动箭头的禁用或启用,并指定禁用或启用哪种箭头. 参数可以是以下值之一: $ESB_DISABLE_BOTH - 两种滚动箭头都禁用. $ESB_DISABLE_DOWN - 禁用垂直滚动的向下箭头. $ESB_DISABLE_LEFT - 禁用水平滚动的向左箭头. $ESB_DISABLE_LTUP - 禁用水平滚动的向左箭头 或垂直滚动向上箭头. $ESB_DISABLE_RIGHT - 禁用水平滚动的向右箭头. $ESB_DISABLE_RTDN - 禁用水平滚动的向右箭头 或垂直滚动的向下箭头. $ESB_DISABLE_UP - 禁用垂直滚动的向上箭头. $ESB_ENABLE_BOTH - 启用两种滚动箭头. |
成功: | 返回 True |
失败: | 返回 False |
在MSDN中搜索
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiScrollBars.au3>
#include <ScrollBarConstants.au3>
Global $iMemo
_Main()
Func _Main()
Local $GUIMsg, $hGUI
$hGUI = GUICreate("ScrollBar Example", 400, 400, -1, -1, BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU, $WS_SIZEBOX))
$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 226, BitOR($WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetResizing($iMemo, $GUI_DOCKALL)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetBkColor(0x88AABB)
GUISetState()
_GUIScrollBars_Init($hGUI)
MemoWrite("Disable down arrow: " & _GUIScrollBars_EnableScrollBar($hGUI, $SB_VERT, $ESB_DISABLE_DOWN))
Sleep(3000)
MemoWrite("Disable up arrow: " & _GUIScrollBars_EnableScrollBar($hGUI, $SB_VERT, $ESB_DISABLE_UP))
Sleep(3000)
MemoWrite("Enable both arrows: " & _GUIScrollBars_EnableScrollBar($hGUI, $SB_VERT, $ESB_ENABLE_BOTH))
Sleep(3000)
MemoWrite("Disable left arrow: " & _GUIScrollBars_EnableScrollBar($hGUI, $SB_HORZ, $ESB_DISABLE_LEFT))
Sleep(3000)
MemoWrite("Disable right arrow: " & _GUIScrollBars_EnableScrollBar($hGUI, $SB_HORZ, $ESB_DISABLE_RIGHT))
Sleep(3000)
MemoWrite("Enable both arrows: " & _GUIScrollBars_EnableScrollBar($hGUI, $SB_HORZ, $ESB_ENABLE_BOTH))
While 1
$GUIMsg = GUIGetMsg()
Switch $GUIMsg
Case $GUI_EVENT_CLOSE;, $nExititem
ExitLoop
EndSwitch
WEnd
Exit
EndFunc ;==>_Main
; 写入一行到 memo 控件
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite