找回密码
 加入
搜索
查看: 3335|回复: 3

[AU3基础] [已解决]帮我看下为什么选不中listviewitem,该怎样改?

[复制链接]
发表于 2013-5-19 20:14:14 | 显示全部楼层 |阅读模式
本帖最后由 oceanwind 于 2013-5-20 11:12 编辑

点num_f按钮后显示出jpglist.当点击一条item后点show按钮 返回都是0.请赐教,谢谢先
代码如下:
#include <GUIConstants.au3>
#include <ButtonConstants.au3>
#include <GuiTab.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <SendMessage.au3>
#include <Date.au3>
#include <Array.au3>
#include <file.au3>
#include <Math.au3>
#include <GDIPlus.au3>
#include <PostMessage_UDF.au3>
#include <ListViewConstants.au3>
#include <GuiListView.au3>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Opt('TrayMenuMode', 1) ;单击不暂停
Opt("WinTitleMatchMode", 2)
Opt("SendKeyDelay", 200)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
GUICreate("a8",200,541,@DesktopWidth-214,100)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$num_fresh_button = GUICtrlCreateButton("num_f", 1,273, 40,20)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$image_file_listview = GUICtrlCreateListView("image file", 1, 294, 199, 80)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$image_Show = GUICtrlCreatePic("", 1, 376, 40, 20)
$image_listview_clear_button = GUICtrlCreateButton("clear", 42,376, 40,20)
$image_listview_show_button = GUICtrlCreateButton("show", 83, 376, 50, 20)
GUISetState(@SW_SHOW )
;MsgBox(0,"",GUICtrlRead($unit_combo))
While 1
        $msg = GUIGetMsg()
        ;;;;;;;;;;;;;;;;;;;
        _deal_gen_msg($msg)
    Sleep(50)
WEnd
Func _deal_gen_msg($mainfunc_msg)
        Switch $mainfunc_msg
                Case -3       
                           Exit       
        Case $num_fresh_button               
                                _select_people_number_file_folder()               
        Case $image_listview_clear_button               
                                _image_file_listview_clear()
        Case $image_listview_show_button               
                                _image_file_listview_item_show()                               
        EndSwitch
EndFunc       
Func _select_people_number_file_folder()
        Local $selected_file_foler = @ScriptDir & "\people_num"
        _set_image_list($selected_file_foler)
EndFunc
Func _set_image_list($passed_file_folder)
        Local $jpg_file_array,$si
    $jpg_file_array = _FileListToArray($passed_file_folder, "*.jpg", 1)
        Local $image_file_listview_hwnd = GUICtrlGetHandle($image_file_listview)
        _GUICtrlListView_DeleteAllItems($image_file_listview_hwnd)

        If IsArray($jpg_file_array) Then
        For $i = 1 To $jpg_file_array[0]
                        _GUICtrlListView_AddItem($image_file_listview, $passed_file_folder & "\" & $jpg_file_array[$i])
            Next
        EndIf       
EndFunc   
Func _image_file_listview_clear()
        Local $image_file_listview_hwnd = GUICtrlGetHandle($image_file_listview)
        _GUICtrlListView_DeleteAllItems($image_file_listview_hwnd)
EndFunc       
Func _image_file_listview_item_show()
        Local $selected_image_file_listview_item = GUICtrlRead($image_file_listview)
        GUICtrlSetImage($image_Show,$selected_image_file_listview_item)
        MsgBox(0, "列表视图项目 ", $selected_image_file_listview_item, 2)
EndFunc
 楼主| 发表于 2013-5-20 09:32:04 | 显示全部楼层
有什么方法没,xdjmm
发表于 2013-5-20 10:37:49 | 显示全部楼层
贴代码要用代码标签,否则既不方便浏览,大家也不愿回复。
由于没有使用代码标签,我就不说明行号了。
Local $selected_image_file_listview_item = _GUICtrlListView_GetItemText($image_file_listview, Number(_GUICtrlListView_GetSelectedIndices($image_file_listview)))

评分

参与人数 1金钱 +10 收起 理由
oceanwind + 10 谢谢....

查看全部评分

 楼主| 发表于 2013-5-20 11:04:07 | 显示全部楼层
贴代码要用代码标签,否则既不方便浏览,大家也不愿回复。
由于没有使用代码标签,我就不说明行号了。
afan 发表于 2013-5-20 10:37



    难怪,就说咋大家贴的都那么整齐。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-2 00:03 , Processed in 0.081102 second(s), 27 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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