确定组合框的下拉列表中的一个特殊项是可见的
#include <GuiComboBoxEx.au3>
_GUICtrlComboBoxEx_SetTopIndex($hWnd, $iIndex)
$hWnd | 控件句柄 |
$iIndex | 指定可见列表项目的 0 基索引 |
#include <GuiComboBoxEx.au3>
#include <GUIConstantsEx.au3>
$Debug_CB = False ;检查传递给 ComboBox/ComboBoxEx 函数的类名, 设置为True并输出到一个控件的句柄,用于检查它是否工作
_Main()
Func _Main()
Local $hGUI, $hCombo
; 创建 GUI
$hGUI = GUICreate("ComboBoxEx Set Top Index", 400, 300)
$hCombo = _GUICtrlComboBoxEx_Create($hGUI, "", 2, 2, 394, 100, $CBS_SIMPLE)
GUISetState()
_GUICtrlComboBoxEx_InitStorage($hCombo, 150, 300)
_GUICtrlComboBoxEx_BeginUpdate($hCombo)
For $x = 0 To 149
_GUICtrlComboBoxEx_AddString($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)))
Next
_GUICtrlComboBoxEx_EndUpdate($hCombo)
;Set Top Index
MsgBox(4160, "信息", "Set Top Index: " & _GUICtrlComboBoxEx_SetTopIndex($hCombo, Random(50, 149, 1)))
MsgBox(4160, "信息", "Top Index: " & _GUICtrlComboBoxEx_GetTopIndex($hCombo))
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc ;==>_Main