jcaixuexi 发表于 2017-1-12 14:42:12

怎样在listview里面添加按钮或者复选框

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <GuiTab.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WinAPISys.au3>
#include <GuiEdit.au3>
#include <array.au3>
#include <WinAPIFiles.au3>




#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
$Tab1 = GUICtrlCreateTab(8, 8, 593, 417)
$TabSheet1 = GUICtrlCreateTabItem("基础功能")
$TabSheet2 = GUICtrlCreateTabItem("软件安装")
$Group1 = GUICtrlCreateGroup("", 24, 56, 75, 337)
$Button1 = GUICtrlCreateButton("设计软件", 24, 56, 75, 25)
$Button3 = GUICtrlCreateButton("办公软件", 24, 80, 75, 25)
$Button4 = GUICtrlCreateButton("浏览器设置", 24, 104, 75, 25)
$Button5 = GUICtrlCreateButton("文印打印机", 24, 128, 75, 25)
$Button6 = GUICtrlCreateButton("邮箱配置", 24, 152, 75, 25)
$Button7 = GUICtrlCreateButton("系统优化", 24, 176, 75, 25)
$Button8 = GUICtrlCreateButton("其他", 24, 200, 75, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$ListView1=GUICtrlCreateListView("", 112, 56, 441, 337)
GUICtrlSetBkColor(-1, $CLR_MONEYGREEN)
_GUICtrlListView_AddColumn($ListView1, "软件名",150)
_GUICtrlListView_AddColumn($ListView1, "软件架构",100)
_GUICtrlListView_AddColumn($ListView1, "软件路径",150)
_GUICtrlListView_AddColumn($ListView1, "备注",41)
$TabSheet3 = GUICtrlCreateTabItem("软件卸载")
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Global $cczzgjpzwj="D:\Mydata\ex_jiangchao\Desktop\cc自助工具1.1\is.ini"
IniWrite($cczzgjpzwj,"设计软件","1","AutoCAD_2010")
IniWrite($cczzgjpzwj,"设计软件","2","PTC_Creo_3.0")
IniWrite($cczzgjpzwj,"设计软件","3","Altium Designer Summer 09")
IniWrite($cczzgjpzwj,"办公软件","1","office2010")
IniWrite($cczzgjpzwj,"办公软件","2","visio2010(32)")
IniWrite($cczzgjpzwj,"办公软件","3","project2010(32)")
IniWrite($cczzgjpzwj,"AutoCAD_2010","软件架构","64bit")
IniWrite($cczzgjpzwj,"AutoCAD_2010","软件路径","10.33.162.55")
IniWrite($cczzgjpzwj,"PTC_Creo_3.0","软件架构","64bit")
IniWrite($cczzgjpzwj,"PTC_Creo_3.0","软件路径","10.33.162.55")
IniWrite($cczzgjpzwj,"Altium Designer Summer 09","软件架构","32/64bit")
IniWrite($cczzgjpzwj,"Altium Designer Summer 09","软件路径","10.33.162.55")
IniWrite($cczzgjpzwj,"office2010","软件架构","32/64bit")
IniWrite($cczzgjpzwj,"office2010","软件路径","10.33.162.55")
IniWrite($cczzgjpzwj,"visio2010(32)","软件架构","32bit")
IniWrite($cczzgjpzwj,"visio2010(32)","软件路径","10.33.162.55")
IniWrite($cczzgjpzwj,"project2010(32)","软件架构","32bit")
IniWrite($cczzgjpzwj,"project2010(32)","软件路径","10.33.162.55")





Func _sj()
   GUICtrlSendMsg($ListView1, $LVM_DELETEALLITEMS, 0, 0)
   Local $IniFile = "D:\Mydata\ex_jiangchao\Desktop\cc自助工具1.1\is.ini"
   Local $aIni = IniReadSection($IniFile,"设计软件")
   If @error Then Exit MsgBox(4096, "", "错误, 读取INI文件失败.")
   Local$jj, $var
   For $jj = 1 To $aIni
   $var = IniReadSection($IniFile, $aIni[$jj])
   GUICtrlCreateListViewItem($aIni[$jj]&"|"&$var&"|"&$var,$ListView1)
   Next
EndFunc

Func _bg()
   GUICtrlSendMsg($ListView1, $LVM_DELETEALLITEMS, 0, 0)
   Local $IniFile = "D:\Mydata\ex_jiangchao\Desktop\cc自助工具1.1\is.ini"
   Local $aIni = IniReadSection($IniFile,"办公软件")
   If @error Then Exit MsgBox(4096, "", "错误, 读取INI文件失败.")
   Local$jj, $var
   For $jj = 1 To $aIni
   $var = IniReadSection($IniFile, $aIni[$jj])
   GUICtrlCreateListViewItem($aIni[$jj]&"|"&$var&"|"&$var,$ListView1)
   Next

EndFunc


While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit
               Case $Button1
                _sj()
         Case $Button3
                   _bg()

   EndSwitch
WEnd

chzj589 发表于 2017-1-12 16:57:10

回复 1# jcaixuexi
应该先把窗口和各种控件使用基础学好,
然后学习控件的函数应用。
一:搜索论坛相关的例子
二:查看帮助文件
三:下载一个目前要练习的例子,反复的编译修改,了解例子里的窗口控件及控件的函数使用。
这样你才能写出你的程序。
如果象目前这种学习方法,最后代码有几句是自己写的?只不过是编辑合成???

jcaixuexi 发表于 2017-1-12 17:56:33

回复 2# chzj589


    目前接触au3时间不长,感觉这个东西很好,在慢慢摸索过程中学习,不懂的地方可能问下,有的时候也想啦很长时间的,实在想不出来的,就问下,多谢前辈的指导。

chzj589 发表于 2017-1-13 15:00:42

回复 3# jcaixuexi
是这种效果,界面可生成,正在研究中


jcaixuexi 发表于 2017-1-13 17:19:07

回复 4# chzj589



正在研究,怎样选择listview选项之后,点击安装,安装所需要的。

chzj589 发表于 2017-1-14 10:14:49

回复 5# jcaixuexi
下载例子学习会快一点理解

jcaixuexi 发表于 2017-1-14 12:54:40

回复 6# chzj589

只有图片哦,哈哈,代码能上传看看吗

chzj589 发表于 2017-1-14 13:02:47

回复chzj589

只有图片哦,哈哈,代码能上传看看吗
jcaixuexi 发表于 2017-1-14 12:54 http://www.autoitx.com/images/common/back.gif
我就是下载别人的例子,所以上传就不好意思了。
论坛搜索吧

jsdn2000 发表于 2017-1-18 08:36:29

先从帮助做起,举一翻三写一些简单的示例来搞明白它,然后再看别人的源码,最好全部写上注释。
页: [1]
查看完整版本: 怎样在listview里面添加按钮或者复选框