damoo 发表于 2014-4-5 21:43:13

高亮显示即可。
#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

jianganew 发表于 2014-8-6 22:38:23

请问各位大侠,楼上的只能显示第一个值,如何再查找下一个,或显示所有含此字段的值?
页: 1 [2]
查看完整版本: [已解决]如何实现在ListView中按条件查找后,让ListView只显示符合条件的行