|
下面是代码,大家看看问题出在哪里啊
#Include <File.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Dim $Txt,$Open,$Close,$LineCount,$String,$SSplit,$StringE,$msg,$Button[64]
GUICreate("资料专用",400,300) ; 创建一个居中显示的 GUI 窗口
$Txt = @ScriptDir&"\test.txt"
$LineCount = _FileCountLines($Txt)
If @error Or $LineCount = 0 Then Exit
$Open = FileOpen($Txt)
For $i = 1 To $LineCount
$String = FileReadLine($Open,$i)
If @error Then ExitLoop
$SSplit = StringSplit($String,"%")
;MsgBox(0,"Error","行未发现分隔符"
If @error Then
MsgBox(0,"Error","行"&$i&"未发现分隔符")
Else
$StringEx = ""
For $Ele In $SSplit
$StringEx = $StringEx&$Ele&@CRLF
MsgBox(0,"Error","行"&$StringEx&"未发现分隔符")
Next
$Button[$i]=GUICtrlCreateButton($StringEx,0, $i*30-29, 400,30)
EndIf
Next
FileClose($Open)
Opt("GUICoordMode", $i)
GUISetState(@SW_SHOW) ; 显示一个空白的窗口
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $Button[1]
MsgBox(0, '测试', '你点击了测试按钮1') ; 点击按钮 2 显示一个简单的对话框
Case $msg = $Button[2]
MsgBox(0, '测试', '你点击了测试按钮2')
Case $msg = $Button[3]
MsgBox(0, '测试', '你点击了测试按钮3')
Case $msg = $Button[4]
MsgBox(0, '测试', '你点击了测试按钮4')
Case $msg = $Button[5]
MsgBox(0, '测试', '你点击了测试按钮5')
Case $msg = $Button[6]
MsgBox(0, '测试', '你点击了测试按钮6')
Case $msg = $Button[7]
MsgBox(0, '测试', '你点击了测试按钮7')
Case $msg = $Button[8]
MsgBox(0, '测试', '你点击了测试按钮8')
;Case $msg = $Button[9]
;MsgBox(0, '测试', '你点击了测试按钮9')
;Case $msg = $Button[10]
; MsgBox(0, '测试', '你点击了测试按钮10')
;Case $msg = $Button[11]
;MsgBox(0, '测试', '你点击了测试按钮11')
EndSelect
WEnd
GUIDelete()
另外这个按钮是文件有多少行,就有多少按钮,点击按钮应该要键入按钮标签的内容,怎么来实现 |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?加入
×
|