#include <GUIConstants.au3>
#include <GuiListBox.au3>
Global $MESSAGE = "列表项目1"
$form = GUICreate("我的 GUI 之列表") ; 创建一个居中显示的窗口
$add = GUICtrlCreateButton("添加", 64, 32, 75, 25)
$clear = GUICtrlCreateButton("清除", 64, 72, 75, 25)
$mylist=GUICtrlCreateList ("列表项目2", 176,32,121,97)
GUICtrlSetLimit(-1, 200) ; 限制水平滚动条
GUICtrlSetData(-1, $MESSAGE)
$close = GUICtrlCreateButton("我的关闭按钮", 64, 160, 175, 25)
GUISetState()
$msg = 0
While $msg <> $GUI_EVENT_CLOSE
$msg = GUIGetMsg()
Select
Case $msg = $add
_GUICtrlListBox_AddString($mylist, "您点击了第一个按钮!")
_GUICtrlListBox_SetCurSel($mylist, _GUICtrlListBox_GetCount($mylist) - 1);
Case $msg = $clear
GUICtrlSetData($mylist, "")
Case $msg = $close
MsgBox(0, "", "关闭按钮被点击", 2)
Exit
EndSelect
WEnd |