tcpuuu 发表于 2011-5-18 23:17:29

求助 紅色上下跑 不會跑到隔壁去 該如何(我的問題已解決)

本帖最后由 tcpuuu 于 2011-5-19 04:13 编辑



按1 紅色亮按上下 紅色只能在第1列上下跑 不會跑到隔壁去
按2 紅色亮按上下 紅色只能在第2列上下跑 不會跑到隔壁去
該如何改 望請高手解答 ! 謝謝GUICreate(" Win ", 180, 480, 840, 0);寬;高;右;上

;

嗯!!!!    謝謝ssjoe 解答
我的問題已解決

ssjoe 发表于 2011-5-19 02:29:39

简单的修改了一下,你看看这样能否合你心意!GUICreate(" Win ", 180, 480, 840, 0);寬;高;右;上

;右;上;寬;高
$1Button = GUICtrlCreateButton("1",22,2,30,20)
GUICtrlSetBkColor($1Button, 0xFF0000)
$2Button = GUICtrlCreateButton("2",54,2,30,20)
$3Button = GUICtrlCreateButton("3",86,2,30,20)
$4Button = GUICtrlCreateButton("4",118,2,30,20)
$5Button = GUICtrlCreateButton("5",150,2,30,20)

$n1 = GUICtrlCreateInput("1",2,3,20,18)

GUICtrlCreateLabel(" 1 ", 7,30,14,12)
GUICtrlCreateLabel(" 2 ", 7,54,14,12)
GUICtrlCreateLabel(" 3 ", 7,78,14,12)
GUICtrlCreateLabel(" 4 ", 7,102,14,12)
GUICtrlCreateLabel(" 5 ", 7,126,14,12)
GUICtrlCreateLabel(" 6 ", 7,150,14,12)
GUICtrlCreateLabel(" 7 ", 7,174,14,12)
GUICtrlCreateLabel(" 8 ", 7,198,14,12)
GUICtrlCreateLabel(" 9 ", 7,222,14,12)
GUICtrlCreateLabel("10", 7,246,14,12)
GUICtrlCreateLabel("11", 7,270,14,12)
GUICtrlCreateLabel("12", 7,294,14,12)
GUICtrlCreateLabel("13", 7,318,14,12)
GUICtrlCreateLabel("14", 7,342,14,12)
GUICtrlCreateLabel("15", 7,366,14,12)
GUICtrlCreateLabel("16", 7,390,14,12)

$L1 = GUICtrlCreateLabel("5", 23,26, 28, 20, 0x00800000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)

$L2 = GUICtrlCreateLabel("4", 23,50, 28, 20, 0x00800000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)

$L3 = GUICtrlCreateLabel("4", 23,74, 28, 20, 0x00800000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)

$L4 = GUICtrlCreateLabel("3", 23,98, 28, 20, 0x00800000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)

$L5 = GUICtrlCreateLabel("3", 23,122, 28, 20, 0x00800000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)

$L6 = GUICtrlCreateLabel("3", 23,146, 28, 20, 0x00800000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)

$L7 = GUICtrlCreateLabel("2", 23,170, 28, 20, 0x00800000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)

$L8 = GUICtrlCreateLabel("2", 23,194, 28, 20, 0x00800000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)

$L9 = GUICtrlCreateLabel("2", 23,218, 28, 20, 0x00800000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)

$L10 = GUICtrlCreateLabel("2", 23,242, 28, 20, 0x00800000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)

$L11 = GUICtrlCreateLabel("1", 23,266, 28, 20, 0x00800000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)

$L12 = GUICtrlCreateLabel("1", 23,290, 28, 20, 0x00800000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)

$L13 = GUICtrlCreateLabel("1", 23,314, 28, 20, 0x00800000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)

$L14 = GUICtrlCreateLabel("1", 23,338, 28, 20, 0x00800000)
GUICtrlSetBkColor(-1, 0xFF0000)
GUICtrlSetFont(-1, 12)

$L15 = GUICtrlCreateLabel("1", 23,362, 28, 20, 0x00800000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)

$L16 = GUICtrlCreateLabel("1", 23,386, 28, 20, 0x00800000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)

$L17 = GUICtrlCreateLabel("2", 56,26, 28, 20, 0x00800000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)

$L18 = GUICtrlCreateLabel("3", 56,50, 28, 20, 0x00800000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)

$L19 = GUICtrlCreateLabel("2", 56,74, 28, 20, 0x00800000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)

$L20= GUICtrlCreateLabel("3", 56,98, 28, 20, 0x00800000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)

$L21 = GUICtrlCreateLabel("4", 56,122, 28, 20, 0x00800000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)

$6Button = GUICtrlCreateButton("down", 20,410, 32,22)
$7Button = GUICtrlCreateButton("up", 20,434, 32,22)

GUISetState()

$bj = $L14;從L14開始
$N = $L16
$M = $L1
While 1
      $msg = GUIGetMsg()
      Switch $msg
                Case -3
                        Exit

Case $1Button
if $N = $L21 then
        GUICtrlSetBkColor($bj, 0xFFFFFF)
        $bj -= 1
Endif
$N = $L16
$M = $L1
If $bj = $L21 Then ContinueLoop
GUICtrlSetBkColor($bj, 0xFFFFFF)
$bj = $L14
GUICtrlSetBkColor($L14, 0xFF0000)
GUICtrlSetBkColor($1Button,0xFF0000)
GUICtrlSetBkColor($2Button,0xF6F6F2)
GUICtrlSetBkColor($3Button,0xF6F6F2)
GUICtrlSetBkColor($4Button,0xF6F6F2)
GUICtrlSetBkColor($5Button,0xF6F6F2)

Case $2Button
$N = $L21
$M = $L17
If $bj = $L21 Then ContinueLoop
GUICtrlSetBkColor($bj, 0xFFFFFF)
$bj = $L17
GUICtrlSetBkColor($L17, 0xFF0000)
GUICtrlSetBkColor($2Button, 0xFF0000)
GUICtrlSetBkColor($1Button,0xF6F6F2)
GUICtrlSetBkColor($3Button,0xF6F6F2)
GUICtrlSetBkColor($4Button,0xF6F6F2)
GUICtrlSetBkColor($5Button,0xF6F6F2)

Case $6Button
If $bj = $N Then ContinueLoop
If $bj = $L21 Then ContinueLoop
GUICtrlSetBkColor($bj, 0xFFFFFF)
$bj += 1
GUICtrlSetBkColor($bj, 0xFF0000)
GUICtrlSetData($n1,GUICtrlRead($bj))

Case $7Button
If $bj > $N Then ContinueLoop
If $bj = $M Then ContinueLoop
If $bj = $L1 Then ContinueLoop
GUICtrlSetBkColor($bj, 0xFFFFFF)
$bj -= 1
GUICtrlSetBkColor($bj, 0xFF0000)
GUICtrlSetData($n1,GUICtrlRead($bj))

EndSwitch
WEnd

hollandmfq 发表于 2014-5-4 10:38:15

雷锋精神传天下!谢谢分享!
页: [1]
查看完整版本: 求助 紅色上下跑 不會跑到隔壁去 該如何(我的問題已解決)