找回密码
 加入
搜索
查看: 3139|回复: 4

[图形处理] listview 读取选中内容 [已解决]

[复制链接]
发表于 2012-2-15 23:29:23 | 显示全部楼层 |阅读模式
本帖最后由 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
求方法
感谢两大神...
发表于 2012-2-16 00:06:54 | 显示全部楼层
MsgBox(0, '选中行的第一列', _GUICtrlListView_GetItemText($hListView, Number(_GUICtrlListView_GetSelectedIndices($hListView))))
发表于 2012-2-16 13:04:22 | 显示全部楼层
用_GUICtrlListView_这个UDF生成的LISTVIEW不是AU3原生的,用guictrlread是读取不了的,用二楼A版大犀牛的代码,或者直接用GUICtrlCreateListViewItem这些AU3原生的函数来生成!

评分

参与人数 1金钱 +15 收起 理由
afan + 15 解释得到位+

查看全部评分

 楼主| 发表于 2012-2-16 17:02:26 | 显示全部楼层
谢 afan  和 benkel  
原先就是用的  GUICtrlCreateListViewItem 这个可以  然后数量多的时候  闪的厉害 改后面这个好像快点.
http://www.autoitx.com/forum.php ... t=%C2%FD%2Blistview
先 _GUICtrlListView_BeginUpdate()
添加完再
_GUICtrlListView_EndUpdate()
afan 发表于 2010-11-1 23:14


先 _GUICtrlListView_BeginUpdate()
添加完再
_GUICtrlListView_EndUpdate()
这两个 是跟 _GUICtrlListView_这个UDF 还是guictrlcreatelistviewitem 有效 还是两个都有效
发表于 2012-2-16 17:03:24 | 显示全部楼层
回复 4# kaitou8


    都有效
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-18 07:03 , Processed in 0.085577 second(s), 28 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表