函数参考


_GUICtrlListBox_SetHorizontalExtent

设置列表框水平滚动的像素宽度

#include <GuiListBox.au3>
_GUICtrlListBox_SetHorizontalExtent($hWnd, $iWidth)

参数

$hWnd 控件的控件ID/句柄
$iWidth 指定列表框滚动的像素数

返回值

None.

注意/说明

To respond to the _GUICtrlListBox_SetHorizontalExtent, the list box must have been defined with
the $WS_HSCROLL style.

相关

_GUICtrlListBox_GetHorizontalExtent

示例/演示


#include <GuiListBox.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Debug_LB = False ;检查传递给 ListBox 函数的类名, 设置为True并输出到一个控件的句柄,用于检查它是否工作

_Main()

Func _Main()
    Local $hListBox

    ; 创建 GUI
    GUICreate("List Box Set Horizontal Extent", 400, 296)
    $hListBox = GUICtrlCreateList("", 2, 2, 396, 296, BitOR($WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_DISABLENOSCROLL, $WS_HSCROLL))
    GUISetState()

    ; Add long string
    _GUICtrlListBox_AddString($hListBox, "AutoIt v3 is a freeware BASIC-like scripting language designed for automating the Windows GUI.")

    ; Show current horizontal extent
    MsgBox(4160, "信息", "Horizontal Extent: " & _GUICtrlListBox_GetHorizontalExtent($hListBox))

    _GUICtrlListBox_SetHorizontalExtent($hListBox, 500)

    ; Show current horizontal extent
    MsgBox(4160, "信息", "Horizontal Extent: " & _GUICtrlListBox_GetHorizontalExtent($hListBox))

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