#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
$Form2 = GUICreate("窗体1", 1001, 674, 14, 32)
$Group1 = GUICtrlCreateGroup("", -1, 8, 1001, 449)
$ListView1 = GUICtrlCreateListView("", 3, 18, 993, 435)
GUICtrlSetStyle($ListView1, $LVS_ICON)
$Group2 = GUICtrlCreateGroup("操作日志", 0, 456, 1000, 217)
$ListView2 = GUICtrlCreateListView("", 3, 472, 993, 198)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
_load1()
;~ Sleep(2000)
;~ _load2()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func _Load1()
Local $hImage, $var, $i, $path, $error, $hFile, $path1, $path2
For $i = 1 To 10 Step 1
$hImage = _GUIImageList_Create(32, 32, 5, 1)
_GUIImageList_AddBitmap($hImage, @ScriptDir & "\闲.bmp")
_GUIImageList_AddBitmap($hImage, @ScriptDir & "\忙.bmp")
_GUICtrlListView_SetImageList($ListView1, $hImage, 0)
_GUICtrlListView_AddItem($ListView1, $i, 0)
Next
EndFunc ;==>_Load1
;~
Func _Load2()
EndFunc ;==>_Load2
Func WM_NOTIFY($hWndGUI, $MsgID, $WParam, $LParam)
Local $tagNMHDR, $Event, $hWndFrom, $IDFrom
Local $tagNMHDR = DllStructCreate("int;int;int", $LParam)
If @error Then Return $GUI_RUNDEFMSG
$IDFrom = DllStructGetData($tagNMHDR, 2)
$Event = DllStructGetData($tagNMHDR, 3)
$tagNMHDR = 0
Switch $IDFrom;选择产生事件的控件
Case $ListView1
Switch $Event; 选择产生的事件
Case $NM_CLICK ; 左击;~ ...
Case $NM_DBLCLK ; 双击
$Index = _GUICtrlListView_GetSelectedIndices($ListView1)
If _GUICtrlListView_GetItemImage($ListView1, Number($Index)) Then
_GUICtrlListView_SetItemImage($ListView1, Number($Index), 0)
Else
_GUICtrlListView_SetItemImage($ListView1, Number($Index), 1)
EndIf
Case $NM_RCLICK ; 右击
MsgBox(0, 0, "点了右键")
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc ;==>WM_NOTIFY
|