开始控件更新,直到 EndUpdate 函数被调用.
#include <GuiListView.au3>
_GUICtrlListView_BeginUpdate($hWnd)
$hWnd | 控件的控件ID/句柄 |
成功: | 返回 True |
失败: | 返回 False |
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
$Debug_LV = False ; 检查传递给 ListView 函数的类名, 设置为True并输出到一个控件的句柄,用于检查它是否工作
_Main()
Func _Main()
Local $hImage, $hListView
GUICreate("ListView Begin Update", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268)
GUICtrlSetStyle($hListView, $LVS_ICON)
GUISetState()
; 加载图像
$hImage = _GUIImageList_Create(32, 32)
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0xFF0000, 32, 32))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x00FF00, 32, 32))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap(GUICtrlGetHandle($hListView), 0x0000FF, 32, 32))
_GUICtrlListView_SetImageList($hListView, $hImage, 0)
; 添加项目
_GUICtrlListView_BeginUpdate($hListView)
For $iI = 1 To 10
_GUICtrlListView_AddItem($hListView, "Red", 0)
_GUICtrlListView_AddItem($hListView, "Green", 1)
_GUICtrlListView_AddItem($hListView, "Blue", 2)
Next
_GUICtrlListView_EndUpdate($hListView)
; 循环直到用户退出
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main