更改控件的回调掩码
#Include <GuiListView.au3>
_GUICtrlListView_SetCallBackMask($hWnd, $iMask)
$hWnd | 控件句柄 |
$iMask | 回调掩码值.掩码的位表明项目的状态或图像对应于当前应用程序存储的状态数据. 此值可以是以下任意组合: 1 - 项目被标记为剪切/粘贴操作 2 - 项目高亮显示为拖放目标 4 - 项目具有焦点 8 - 项目被选中 16 - 应用程序存储当前叠加图像的图像列表索引 32 - 应用程序存储当前状态图像的图像列表索引 |
成功: | 返回 True |
失败: | 返回 False |
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
$Debug_LV = False ; 检查传递给 ListView 函数的类名, 设置为True并输出到一个控件的句柄,用于检查它是否工作
Example_UDF_Created()
Func Example_UDF_Created()
Local $GUI, $hImage, $hListView
$GUI = GUICreate("(UDF Created) ListView Set CallBack Mask", 400, 300)
$hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 394, 268)
GUISetState()
_GUICtrlListView_SetCallBackMask($hListView, 32)
MsgBox(4160, "信息", "CallBackMask: " & _GUICtrlListView_GetCallbackMask($hListView))
; 加载图像
$hImage = _GUIImageList_Create()
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xC0C0C0, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF00FF, 16, 16))
_GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFFFF00, 16, 16))
_GUICtrlListView_SetImageList($hListView, $hImage, 1)
_GUICtrlListView_SetImageList($hListView, $hImage, 2)
; 添加列
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)
; 添加项目 with callback for item text
_GUICtrlListView_AddItem($hListView, -1, 0)
_GUICtrlListView_AddItem($hListView, -1, 1)
_GUICtrlListView_AddItem($hListView, -1, 2)
; 循环直到用户退出
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example_UDF_Created