#include <GUIListView.au3>
Opt("GUIOnEventMode", 1)
GUICreate("", 400, 300)
GUISetOnEvent(-3, "_EventResponse")
$ListView1 = GUICtrlCreateListView("|", 5, 5, 390, 250)
_GUICtrlListView_SetColumnWidth($ListView1, 0, 350)
$Button1 = GUICtrlCreateButton("Button1", 312, 260, 75, 25)
GUICtrlSetOnEvent(-1, "_EventResponse")
GUISetState()
While 1
Sleep(100)
WEnd
Func _EventResponse()
Switch @GUI_CtrlId
Case -3
Exit
Case $Button1
$var = FileOpenDialog('', '', "图像文件 (*.jpg;*.bmp)", 1 + 4)
If Not @error Then
If StringInStr($var, '|') Then
$a = StringSplit($var, '|')
For $i = 2 To $a[0]
GUICtrlCreateListViewItem($a[1] & '\' & $a[$i], $ListView1)
Next
Else
GUICtrlCreateListViewItem($var, $ListView1)
EndIf
EndIf
EndSwitch
EndFunc ;==>_EventResponse
|