不知道楼上的朋友是不是理解错了,我是这样理解的。#include <GUIListView.au3>
#include <WindowsConstants.au3>
GUICreate("ListView", 280, 300)
$ListView1 = GUICtrlCreateListView("编号|姓名|ID", 1, 1, 278, 230, -1, _
BitOR($WS_EX_CLIENTEDGE, $LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT, $LVS_REPORT))
_GUICtrlListView_SetColumnWidth($ListView1, 1, 100)
_GUICtrlListView_SetColumnWidth($ListView1, 2, 100)
$Input1 = GUICtrlCreateInput("李四", 58, 252, 121, 21)
$Button1 = GUICtrlCreateButton("按姓名搜索", 180, 250, 80, 25)
GUICtrlCreateListViewItem('1|张三|65786315', $ListView1)
GUICtrlCreateListViewItem('2|李四|56454688', $ListView1)
GUICtrlCreateListViewItem('3|王五|86575765', $ListView1)
GUICtrlCreateListViewItem('4|孙六|87654832', $ListView1)
GUICtrlCreateListViewItem('5|赵七|96325478', $ListView1)
GUICtrlCreateListViewItem('6|成八|64651873', $ListView1)
GUICtrlCreateListViewItem('7|冯九|96437251', $ListView1)
GUICtrlCreateListViewItem('8|钱十|64976835', $ListView1)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case - 3
Exit
Case $Button1
_Search(GUICtrlRead($Input1))
EndSwitch
WEnd
Func _Search($sText)
$iIndex = _GUICtrlListView_FindInText($ListView1, $sText)
_GUICtrlListView_ClickItem($ListView1, $iIndex)
EndFunc ;==>_Search
|