找回密码
 加入
搜索
查看: 5537|回复: 11

[AU3基础] [已解决]想获得listview控件的全部内容,但输出为什么是这样?

  [复制链接]
发表于 2010-4-9 16:33:54 | 显示全部楼层 |阅读模式
本帖最后由 superpangya 于 2010-4-13 08:17 编辑



只是想让它控原来列表的形式显示,但是为什么输出的是叠加的效果?
[MsgBox(4160, "Information", "Item 5 Text: " & _GUICtrlListBox_GetText($ListView1,1)),这个也不能显示出"1"行的完整记录,只能显示ID字段]

附:原码与数据库

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
 楼主| 发表于 2010-4-9 16:35:07 | 显示全部楼层
发表于 2010-4-9 22:11:57 | 显示全部楼层
用链接模式干什么
发表于 2010-4-9 22:47:37 | 显示全部楼层
函数使用错误。
应该用_GUICtrlListView_GetItemTextString($hListView, 1)吧
 楼主| 发表于 2010-4-10 19:14:51 | 显示全部楼层
本帖最后由 superpangya 于 2010-4-10 19:17 编辑

回复 3# netegg


    我也不知道啊,看见例子上这么用,我就搬过来了, 我现在想弄明白两个问题,一,用这种办法,怎么改可以把输出弄成理想状态,第二,正确的应该用什么代码?  

        (我刚刚学AU3,有些很基础的东西都不懂,但急着把这个做好,,有什么不懂的,还请大家帮帮忙了..)
 楼主| 发表于 2010-4-10 19:17:31 | 显示全部楼层
回复 4# 3mile


    呵呵,谢谢,我试试看.
发表于 2010-4-11 13:01:04 | 显示全部楼层
Func lala()
        Local $aItem, $sText,$text,$i,$a,$b
        $a = _GUICtrlListView_GetItemCount($ListView1)
        For $b = 0 To $a -1
             $aItem = _GUICtrlListView_GetItemTextArray($ListView1, $b)
         For $i = 2 To $aItem[0]
             $sText = $sText &StringFormat("%s ", $aItem[$i])
         Next
        $stext =$stext& @CRLF
    Next
    MsgBox(4160, "Information", $stext)
EndFunc
 楼主| 发表于 2010-4-12 09:14:29 | 显示全部楼层
回复 7# shqf


    弱弱的问一下,为什么输出是一排呢?
$stext =$stext& @CRLF  这里后面加两个@CRLF也无济于事....
发表于 2010-4-12 10:01:30 | 显示全部楼层
#include <GUIListView.au3>
#include <WindowsConstants.au3>

GUICreate("ListView", 320, 300)
$ListView1 = GUICtrlCreateListView("编号|姓名|ID", 1, 1, 318, 230, -1, _
                BitOR($WS_EX_CLIENTEDGE, $LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT, $LVS_REPORT))
$anniu1 = GUICtrlCreateButton("获取全部文本", 100, 250, 100, 30)
_GUICtrlListView_SetColumnWidth($ListView1, 0, 50)
_GUICtrlListView_SetColumnWidth($ListView1, 1, 100)
_GUICtrlListView_SetColumnWidth($ListView1, 2, 100)
GUISetState(@SW_SHOW)

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)

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case - 3
                        Exit
                Case $anniu1
                        Read()
        EndSwitch
WEnd

Func Read()
        Local $sText
        For $i = 0 To _GUICtrlListView_GetItemCount($ListView1) - 1
                $sText &= _GUICtrlListView_GetItemTextString($ListView1, $i) & @CRLF
        Next
        MsgBox(64, '全部项目文本', $sText)
        $sText = ''
EndFunc   ;==>Read
发表于 2010-4-12 12:57:58 | 显示全部楼层
回复 8# superpangya


    你多用了一个变量,累加重复了
 楼主| 发表于 2010-4-12 14:09:46 | 显示全部楼层
水木子 发表于 2010-4-12 10:01


代码在下面这处报错,应该是", _ "的问题,但我不会改.......
    $ListView1 = GUICtrlCreateListView("编号|姓名|ID", 1, 1, 318, 230, -1, _
 楼主| 发表于 2010-4-12 14:10:49 | 显示全部楼层
回复 10# shqf

呵呵,代码重新检查了一遍,现在好了.
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-6-9 23:52 , Processed in 0.084624 second(s), 22 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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