listview 读取选中内容 [已解决]
本帖最后由 kaitou8 于 2012-2-16 19:40 编辑#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work
_Main()
Func _Main()
Local $hImage, $hListView
; Create GUI
GUICreate("ListView Add SubItem", 400, 300)
GUICtrlCreateButton('显示选中行的第1列',100,280,160,18)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 268, -1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))
GUISetState()
; Add columns
_GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)
_GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100)
_GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100)
; Add items
For $i = 0 To 1999
_GUICtrlListView_AddItem($hListView, "Row "&$i+1&": Col 1", $i)
For $j = 1 To 2
_GUICtrlListView_AddSubItem($hListView,$i , "Row "&$i+1&": Col "&$j+1, $j)
Next
Next
; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main
读取选中那行的第一列内容... 用guictrlread(guictrlread($hlistview)) 输出0
求方法
感谢两大神... MsgBox(0, '选中行的第一列', _GUICtrlListView_GetItemText($hListView, Number(_GUICtrlListView_GetSelectedIndices($hListView)))) 用_GUICtrlListView_这个UDF生成的LISTVIEW不是AU3原生的,用guictrlread是读取不了的,用二楼A版大犀牛的代码,或者直接用GUICtrlCreateListViewItem这些AU3原生的函数来生成! 谢 afan和 benkel
原先就是用的GUICtrlCreateListViewItem 这个可以然后数量多的时候闪的厉害 改后面这个好像快点.
http://www.autoitx.com/forum.php?mod=viewthread&tid=19395&highlight=%C2%FD%2Blistview 中
先 _GUICtrlListView_BeginUpdate()
添加完再
_GUICtrlListView_EndUpdate()
afan 发表于 2010-11-1 23:14 http://www.autoitx.com/images/common/back.gif
先 _GUICtrlListView_BeginUpdate()
添加完再
_GUICtrlListView_EndUpdate()
这两个 是跟 _GUICtrlListView_这个UDF 还是guictrlcreatelistviewitem 有效 还是两个都有效 回复 4# kaitou8
都有效
页:
[1]