[已解决]按1次down 紅色往下跑, 再按1次再往下跑
本帖最后由 tcpuuu 于 2010-8-13 00:09 编辑按1次down 紅色往下跑, 再按1次再往下跑
按up 往上跑這要怎麼 編ㄚ?
求助好心人教教我 我的e-mail :hh.tr@msa.hinet.net
----------------------------------------------------
#include <GUIConstants.au3>
GUICreate(" Win ", 110, 302,800,2) ; 建窗口
GUICtrlCreateLabel ("1",2,2,62,36,$WS_BORDER)
GUICtrlSetBkColor(-1,0xFF0000)
GUICtrlSetFont (-1,24 );GUICtrlSetStyle (-1, $SS_RIGHT )
GUICtrlCreateLabel ("2",2,40,62,36,$WS_BORDER)
GUICtrlSetBkColor(-1,0xFFFFFF)
GUICtrlSetFont (-1,24 );GUICtrlSetStyle (-1, $SS_RIGHT )
GUICtrlCreateLabel ("3",2,78,62,36,$WS_BORDER)
GUICtrlSetBkColor(-1,0xFFFFFF)
GUICtrlSetFont (-1,24 );GUICtrlSetStyle (-1, $SS_RIGHT )
$1Button = GUICtrlCreateButton("down", 65, 1, 40,30);建按鈕控件
$2Button = GUICtrlCreateButton("up", 65, 31, 40,30);建按鈕控件
GUISetState(@SW_SHOW)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $1button
Case $msg = $2button
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
EndSelect
WEnd GUICreate(" Win ", 110, 302, 800, 2)
$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("down", 65, 1, 40, 30)
$2Button = GUICtrlCreateButton("up", 65, 31, 40, 30)
$3Button = GUICtrlCreateButton("Cycle", 65, 62, 40, 30)
GUISetState()
$bj = $L1
While 1
$msg = GUIGetMsg()
Switch $msg
Case -3
Exit
Case $1Button
If $bj = $L3 Then ContinueLoop
GUICtrlSetBkColor($bj, 0xFFFFFF)
$bj += 1
GUICtrlSetBkColor($bj, 0xFF0000)
Case $2Button
If $bj = $L1 Then ContinueLoop
GUICtrlSetBkColor($bj, 0xFFFFFF)
$bj -= 1
GUICtrlSetBkColor($bj, 0xFF0000)
Case $3Button
GUICtrlSetBkColor($bj, 0xFFFFFF)
$bj += 1
If $bj = $L3 + 1 Then $bj = $L1
GUICtrlSetBkColor($bj, 0xFF0000)
EndSwitch
WEnd 順便在上面加上了循環按鈕 我也来一个#include <GUIConstants.au3>
#include <WindowsConstants.au3>
GUICreate(" Win ", 110, 302,800,2) ; 建窗口
$Label1 = GUICtrlCreateLabel ("1",2,2,62,36,$WS_BORDER)
GUICtrlSetBkColor(-1,0xFF0000)
GUICtrlSetFont (-1,24 );GUICtrlSetStyle (-1, $SS_RIGHT )
$Label2 = GUICtrlCreateLabel ("2",2,40,62,36,$WS_BORDER)
GUICtrlSetBkColor(-1,0xFFFFFF)
GUICtrlSetFont (-1,24 );GUICtrlSetStyle (-1, $SS_RIGHT )
$Label3 = GUICtrlCreateLabel ("3",2,78,62,36,$WS_BORDER)
GUICtrlSetBkColor(-1,0xFFFFFF)
GUICtrlSetFont (-1,24 );GUICtrlSetStyle (-1, $SS_RIGHT )
$1Button = GUICtrlCreateButton("down", 65, 1, 40,30);建按鈕控件
$2Button = GUICtrlCreateButton("up", 65, 31, 40,30);建按鈕控件
GUISetState(@SW_SHOW)
Global $s = 1
While 1
$msg = GUIGetMsg()
Switch $msg
Case $1Button
GUICtrlSetBkColor(Eval("Label"&$s),0xFFFFFF)
$s += 1
If $s = 4 Then $s = 1
GUICtrlSetBkColor(Eval("Label"&$s),0xFF0000)
Case $2Button
GUICtrlSetBkColor(Eval("Label"&$s),0xFFFFFF)
$s -= 1
If $s = 0 Then $s = 3
GUICtrlSetBkColor(Eval("Label"&$s),0xFF0000)
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd 謝謝你們! 你們好厲害ㄛ!
我 台灣人 好笨! 再請教你們一下
如果跑到2 除了紅色往下移 再 執行222.exe
Run("c:\222.exe")
跑到3紅色往下移再執行333.exe
Run("c:\333.exe")
------------------------------------------------------------
這要如何寫...?
謝謝你們! GUICreate(" Win ", 110, 302, 800, 2)
$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("down", 65, 1, 40, 30)
$2Button = GUICtrlCreateButton("up", 65, 31, 40, 30)
$3Button = GUICtrlCreateButton("Cycle", 65, 62, 40, 30)
GUISetState()
Dim $bj = $L1
Dim $exe = ['程式1(aaa).exe', '程式2(bbb).exe', '程式3(ccc).exe']
While 1
$msg = GUIGetMsg()
Switch $msg
Case -3
Exit
Case $1Button
If $bj = $L3 Then ContinueLoop
GUICtrlSetBkColor($bj, 0xFFFFFF)
$bj += 1
GUICtrlSetBkColor($bj, 0xFF0000)
msgbox(0, 0, $exe[$bj - 3], 1)
Case $2Button
If $bj = $L1 Then ContinueLoop
GUICtrlSetBkColor($bj, 0xFFFFFF)
$bj -= 1
GUICtrlSetBkColor($bj, 0xFF0000)
msgbox(0, 0, $exe[$bj - 3], 1)
Case $3Button
GUICtrlSetBkColor($bj, 0xFFFFFF)
$bj += 1
If $bj = $L3 + 1 Then $bj = $L1
GUICtrlSetBkColor($bj, 0xFF0000)
msgbox(0, 0, $exe[$bj - 3], 1)
EndSwitch
WEnd具體應用將 msgbox(0, 0, $exe[$bj - 3], 1) 替換成 Run($exe[$bj - 3]) 即可 本帖最后由 afan 于 2010-8-12 02:19 编辑
精簡下GUICreate(" Win ", 110, 302, 800, 2)
$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("down", 65, 1, 40, 30)
$2Button = GUICtrlCreateButton("up", 65, 31, 40, 30)
$3Button = GUICtrlCreateButton("Cycle", 65, 62, 40, 30)
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 A1, 8#代码 第4行與第8行調換,第20改為 Dim $bj = $L2 即可。
A2, “按下去 原地不動”不太懂意思… 楼主能不能把问题一次问明白,一点点挤牙膏似的,太不适合设计代码了 謝謝!板主 解說 ....不好意思 打擾了
“按下去 原地不動”不太懂意思…
----------------------------------------------
按DOWN 跑到2執行'C:\程式2(bbb).exe'
如果按 第三鍵3Button(原地不動,不上也不下) 停在2再執行'C:\程式2(bbb).exe' 一次 那第三鍵只起到重複執行的作用,并不做循環之用,是這意思嗎? 本帖最后由 tcpuuu 于 2010-8-12 22:23 编辑
對的! 第3鍵不做循環
----------------------------------
如果 按1或2 鍵, 紅色跑到3 執行3.EXE
這時按第3鍵紅色停在原地3 再執行 3.EXE一次
如果 按1或2 鍵, 紅色跑到2 執行2.EXE
這時按第3鍵紅色停在原地2 再執行 2.EXE一次
----------------------------------------------------------
第3鍵 讓 紅色不移動 (停在原地再執行原地的 XXX.exe 一次)
---再次感謝 板主afan --- GUICreate(" Win ", 110, 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("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
If $msg = $3Button And $bj = $L3 + 1 Then $bj = $L1
GUICtrlSetBkColor($bj, 0xFF0000)
MsgBox(0, 0, $exe[$bj - 3], 1)
EndFunc ;==>Go Case $1Button To $2Button
Go($msg)
Case $3Button
MsgBox(0, 0, $exe[$bj - 3], 1)
-------------------------------------------
正確!我的問題已解決
感謝板主afan 不厭其煩 解說
另有一篇 關於 導入進度條?望請解答.
页:
[1]