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

想做一个不确定有多少个按钮的小选单,有没有高手给个提示

[复制链接]
发表于 2009-6-21 17:33:40 | 显示全部楼层 |阅读模式
像图中那样,按钮的信息通过INI文件读取,我可以通过iniReadSection函数获取INI文件的所有信息并通过UBound函数来得到到底有几个按钮  但是在gui输出上面却不知道如何下手 请高手指教一下 谢谢

本帖子中包含更多资源

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

×
 楼主| 发表于 2009-6-21 17:43:24 | 显示全部楼层
附上INI文件

[list]
name1=正常启动劲舞团
run1=d:\窗口化.exe

name2=NT兼容模式启动
run2=d:\paly1.bat

name3=2000兼容模式启动
run3=d:\play2.bat

name4=98兼容模式启动
run4=d:\play3.bat
发表于 2009-6-21 18:42:05 | 显示全部楼层
本帖最后由 大绯狼 于 2009-6-21 18:59 编辑

[au3]#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)
Dim $Button[1]
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 198, 447, 193, 125)
GUISetOnEvent($GUI_EVENT_CLOSE, "main")

$i = 0
While 1
        $i += 1
        ReDim $Button[$i]
        $temp = IniRead("txt.txt", "list", "name" & $i, "")
        If $temp = "" Then ExitLoop
        $Button[$i - 1] = GUICtrlCreateButton($temp, 48, 18 + $i * 30, 120, 25, 0)

        GUICtrlSetOnEvent($Button[$i - 1], "main")
WEnd
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        Sleep(100)
WEnd

Func main()
        For $i = 1 To UBound($Button)
                Switch @GUI_CtrlId
                        Case $GUI_EVENT_CLOSE
                                Exit
                        Case $Button[$i-1]
                                MsgBox(0, "", IniRead("txt.txt", "list", "run" & $i, ""))
                EndSwitch
        Next
EndFunc   ;==>main[/au3]
发表于 2009-6-22 11:11:02 | 显示全部楼层
读按钮数量 每增加一个自增高度
 楼主| 发表于 2009-6-24 09:59:00 | 显示全部楼层
感谢二楼提供的思路 我先试试看吧 谢谢了
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-23 01:34 , Processed in 0.074808 second(s), 22 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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