#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 633, 454, 192, 114)
$Input1 = GUICtrlCreateInput("hp", 64, 32, 169, 21, 0,0)
;GUICtrlSetBkColor(-1,0xECE9D8)
$ListView1 = GUICtrlCreateListView("test|gg", 48, 96, 321, 73)
GUICtrlCreateListViewItem("中国",$ListView1)
GUICtrlCreateListViewItem("中国",$ListView1)
GUICtrlCreateListViewItem("中国",$ListView1)
GUICtrlCreateListViewItem("中国",$ListView1)
GUICtrlCreateListViewItem("中国",$ListView1)
GUICtrlCreateListViewItem("中国",$ListView1)
GUICtrlCreateListViewItem("中国",$ListView1)
GUICtrlCreateListViewItem("中国",$ListView1)
GUICtrlCreateListViewItem("pp",$ListView1)
GUICtrlCreateListViewItem("中国",$ListView1)
GUICtrlCreateListViewItem("hp",$ListView1)
$button1 = GUICtrlCreateButton("发送", 168, 224, 177, 41)
GUICtrlSetState(-1, $GUI_FOCUS)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
case $Button1
$text =GUICtrlRead($input1)
$y=_GUICtrlListView_FindText($ListView1, $text)
_GUICtrlListView_SetItemSelected($ListView1, $y,True,True)
_GUICtrlListView_EnsureVisible($ListView1, $y)
EndSwitch
WEnd
请看看,这样选中的效果如下图
也不达到用鼠标选中时的状态那样
|