[已解决]往上不循環(這要如何改阿)
本帖最后由 tcpuuu 于 2010-8-16 03:22 编辑GUISetState()
Dim $bj = $L1
Dim $exe = ['C:\程式1(aaa).exe', 'C:\程式2(bbb).exe', 'C:\程式3(ccc).exe']
While 1
$msg = GUIGetMsg()
Switch $msg
Case -3
Exit
Case $1Button To $3Button
Go($msg)
EndSwitch
WEnd
Func Go($msg)
If ($msg = $1Button And $bj = $L3) Or ($msg = $2Button And $bj = $L1) Then Return
GUICtrlSetBkColor($bj, 0xFFFFFF)
$bj += 1
If $msg = $2Button Then $bj -= 2
If $msg = $3Button And $bj = $L3 + 1 Then $bj = $L1
GUICtrlSetBkColor($bj, 0xFF0000)
MsgBox(0, 0, $exe[$bj - 3], 1)
EndFunc ;==>Go
-------------------------------------------------------------
請教 板主afan !對不起 又來打擾
第1 上 往上不循環
第2 stop 不上也不下
第3下 往下跑到3 -再按 - 循環到1
------------------------------------------
要如何修改!我好久都不會望請解答 本帖最后由 水木子 于 2010-8-15 09:05 编辑
afan前辈的影响力实在太大了,现在大家有问题都直接点名请他来帮忙了。
尔等需加油哦!
建议楼主修改下标题,目前的标题不方便大家搜索。 能力有限,不知道你是不是要这样的效果,只做了“下”Dim $exe = ['C:\程式1(aaa).exe', 'C:\程式2(bbb).exe', 'C:\程式3(ccc).exe']
Local $nLocation = 3
GUICreate(" Win ", 200, 300)
$L1 = GUICtrlCreateLabel("1", 2, 2, 62, 36, 0x00800000) ;$WS_BORDER = 0x00800000
GUICtrlSetBkColor(-1, 0xFF0000)
GUICtrlSetFont(-1, 24)
$L2 = GUICtrlCreateLabel("2", 2, 40, 62, 36, 0x00800000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 24)
$L3 = GUICtrlCreateLabel("3", 2, 78, 62, 36, 0x00800000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 24)
$1Button = GUICtrlCreateButton("上", 65, 1, 40, 30)
$2Button = GUICtrlCreateButton("下", 65, 31, 40, 30)
$3Button = GUICtrlCreateButton("Cycle", 65, 62, 40, 30)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case - 3
Exit
Case $2Button
Go()
EndSwitch
WEnd
Func Go()
$nLocation += 1
If $nLocation = 6 Then $nLocation = 3
For $i = 3 To 5
If $i = $nLocation Then
GUICtrlSetBkColor($i, 0xFF0000)
ContinueLoop
EndIf
GUICtrlSetBkColor($i, 0xFFFFFF)
Next
EndFunc ;==>Go 謝謝水木子回應
---------------------------
上不去而且沒 執行'C:\程式1(aaa).exe', 'C:\程式2(bbb).exe', 'C:\程式3(ccc).exe'
我貼上原本 全文:
-------------------------
GUICreate(" Win ", 110, 302, 800, 2);A1, 8#代? 第4行與第8行調換,第20改為 Dim $bj = $L2 即可。
$L1 = GUICtrlCreateLabel("1", 2, 2, 62, 36, 0x00800000) ;$WS_BORDER = 0x00800000
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 24)
$L2 = GUICtrlCreateLabel("2", 2, 40, 62, 36, 0x00800000)
GUICtrlSetBkColor(-1, 0xFF0000)
GUICtrlSetFont(-1, 24)
$L3 = GUICtrlCreateLabel("3", 2, 78, 62, 36, 0x00800000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 24)
$1Button = GUICtrlCreateButton("down", 65, 1, 40, 30)
$2Button = GUICtrlCreateButton("up", 65, 31, 40, 30)
$3Button = GUICtrlCreateButton("Cycle", 65, 62, 40, 30)
GUISetState()
Dim $bj = $L2
Dim $exe = ['C:\程式1(aaa).exe', 'C:\程式2(bbb).exe', 'C:\程式3(ccc).exe']
While 1
$msg = GUIGetMsg()
Switch $msg
Case -3
Exit
Case $1Button To $2Button
Go($msg)
Case $3Button
MsgBox(0, 0, $exe[$bj - 3], 1)
EndSwitch
WEnd
Func Go($msg)
If ($msg = $1Button And $bj = $L3) Or ($msg = $2Button And $bj = $L1) Then Return
GUICtrlSetBkColor($bj, 0xFFFFFF)
$bj += 1
If $msg = $2Button Then $bj -= 2
GUICtrlSetBkColor($bj, 0xFF0000)
MsgBox(0, 0, $exe[$bj - 3], 1)
EndFunc ;==>Go
---------------------------------------------------------------------------------------
希望以下這樣"
-------------------
第1 鍵上 往上跑到1 不再循環
第2 鍵stop 不上也不下
第3鍵 下 往下跑到3 -再按 - 循環到1
------------------------------------------------------
1個 不循環
1個 可 循環
1個 停在原地 再執行原地 .EXE1次 回复 4# tcpuuu
這些功能好像前面都已經實現過了吧 — — || GUICreate(" Win ", 150, 302, 800, 2)
$L1 = GUICtrlCreateLabel("1", 2, 2, 62, 36, 0x00800000) ;$WS_BORDER = 0x00800000
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 24)
$L2 = GUICtrlCreateLabel("2", 2, 40, 62, 36, 0x00800000)
GUICtrlSetBkColor(-1, 0xFF0000)
GUICtrlSetFont(-1, 24)
$L3 = GUICtrlCreateLabel("3", 2, 78, 62, 36, 0x00800000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 24)
$1Button = GUICtrlCreateButton("往下要循環", 65, 1, 80, 30)
$2Button = GUICtrlCreateButton("原地執行", 65, 31, 80, 30)
$3Button = GUICtrlCreateButton("往上不循環", 65, 62, 80, 30)
GUISetState()
Dim $bj = $L2
Dim $exe = ['C:\程式1(aaa).exe', 'C:\程式2(bbb).exe', 'C:\程式3(ccc).exe']
While 1
$msg = GUIGetMsg()
Switch $msg
Case -3
Exit
Case $1Button, $3Button
Go($msg)
Case $2Button
MsgBox(0, 0, $exe[$bj - 3], 1)
EndSwitch
WEnd
Func Go($msg)
If ($msg = $3Button And $bj = $L1) Then Return ;Or ($msg = $3Button And $bj = $L1)
GUICtrlSetBkColor($bj, 0xFFFFFF)
$bj += 1
If $msg = $3Button Then $bj -= 2
If $msg = $1Button And $bj = $L3 + 1 Then $bj = $L1
GUICtrlSetBkColor($bj, 0xFF0000)
MsgBox(0, 0, $exe[$bj - 3], 1)
EndFunc ;==>Go afan 超级版主 您好! 非常感謝您的解說 (我的問題已解決)
現在我3種 都有了
("往下要循環")
("原地執行", )
("往上不循環",)
-----------------------
往下不循環
往上不循環
原地停
---------------
往上不循環
往下不循環
往上往下都循環
页:
[1]