高亮显示即可。#Region ;**** 参数创建于 ACNWrapper_GUI ****
#PRE_Outfile=-32.exe
#PRE_Outfile_x64=-64.exe
#PRE_Compile_Both=y
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <GuiListView.au3>
#include <Array.au3>
GUICreate("在ListView中按关键词进行查找的例子",400,310)
$add = GUICtrlCreateButton("插入新行",120,30,90,23)
$search = GUICtrlCreateButton("按关键字查找",220,30,90,23)
$key = GUICtrlCreateInput("tom32",20,30)
$lsv = GUICtrlCreateListView("ID|Name|Age",20,70,360,200)
For $i=0 To 50 Step 1
GUICtrlCreateListViewItem($i&"|Tom"&$i&"|"&10+$i,$lsv)
Next
GUISetState()
Func add()
$index = _GuictrlListview_getItemCount($lsv)
_GUICtrlListView_InsertItem($lsv,"11",$index)
_GUICtrlListView_SetItemText($lsv,$index,GUICtrlRead($key),1)
_GUICtrlListView_SetItemText($lsv,$index,"99",2)
_GUICtrlListView_EnsureVisible($lsv,$index)
EndFunc
Func search()
$index = _GUICtrlListView_FindInText($lsv,GUICtrlRead($key))
_GUICtrlListView_EnsureVisible($lsv,$index)
_GUICtrlListView_SetItemSelected($lsv,$index)
MsgBox(0,0,GUICtrlRead(GUICtrlRead($lsv)),2)
EndFunc
While 1
$msg = GUIGetMsg()
switch $msg
Case $GUI_EVENT_CLOSE
Exit
Case $add
add()
Case $search
search()
EndSwitch
WEnd
|