#region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_UseX64=n
#endregion ;**** 参数创建于 ACNWrapper_GUI ****
Opt("TrayMenuMode", 3) ;设置不显示默认菜单项目 (脚本暂停中/退出)
#include "XCGUI_Fun.au3"
#include <Constants.au3>
XInitXCGUI()
$create = XWnd_Create(0, 0, 600, 500, "窗口测试", 47)
XWnd_RegEventC($create, "OnWndMenuSelect", $XWM_MENU_SELECT)
$btn2 = XBtn_Create("400", "4", "75", "25", "退出程序", $create)
XEle_RegEventC($btn2, "btn2")
$XList = XList_Create("20", "40", "440", "400", $create) ;创建列表元素
XList_EnableDragChangeColumnWidth($XList, 0)
XList_AddColumn($XList, 100) ;设置列宽
XList_AddColumn($XList, 105)
XList_AddColumn($XList, 105)
$XAm = XAdapterMap_Create() ;创建数据适配器,单列数据
XList_BindAdapterHeader($XList, $XAm) ;绑定数据适配器
XAdapterMap_AddItemText($XAm, "name", "111") ;设置列名称
XAdapterMap_AddItemText($XAm, "name2", "222")
XAdapterMap_AddItemText($XAm, "name3", "333")
$XA = XAdapterTable_Create() ;创建列表框元素数据适配器
XList_BindAdapter($XList, $XA) ;绑定数据适配器
XAdapterTable_AddColumn($XA, "name") ;添加数据列
XAdapterTable_AddColumn($XA, "name2")
XAdapterTable_AddColumn($XA, "name3")
For $i=0 To 200 Step 1
$ii=$i+1
If StringLen($ii)<2 Then $ii="0"&$ii
If StringLen($ii)<3 Then $ii="0"&$ii
XAdapterTable_AddItemTextEx($XA, "name", $ii)
XAdapterTable_SetItemText($XA, $i, 1, "在线") ;设置项数据
XAdapterTable_SetItemText($XA, $i, 2, "是") ;设置项数据
Next
XWnd_ShowWindow($create)
While 1
Switch TrayGetMsg()
Case $TRAY_EVENT_SECONDARYDOWN ;鼠标右键被点击
_tray()
EndSwitch
WEnd
Func btn2($bh)
xquit_acn($create)
EndFunc ;==>btn2
Func _tray()
$traypos = MouseGetPos()
$hMenu = XMenu_Create() ;创建菜单.默认弹出菜单窗口关闭后自动销毁
XMenu_AddItem($hMenu, 201, "改变颜色", $XC_ID_ROOT, 0) ;添加菜单项
;弹出菜单
XMenu_Popup($hMenu, XWnd_GetHWND($create), $traypos[0], $traypos[1], 0, 0)
EndFunc ;==>_tray
Func OnWndMenuSelect($nID)
For $i=0 To 15 Step 1
XShapeText_SetTextColor(XList_GetTemplateObject($XList,$i,1),0xFF00FF,255)
XShapeText_SetTextColor(XList_GetTemplateObject($XList,$i,2),0xFF00FF,255)
XShapeText_SetTextColor(XList_GetTemplateObject($XList,$i,3),0xFF00FF,255)
Next
XEle_RedrawEle($XList, 1)
EndFunc ;==>OnWndMenuSelect