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

[交流] 求助 $edit2+=1 按1次加1 為什麼都是+3

  [复制链接]
发表于 2011-5-19 10:12:43 | 显示全部楼层 |阅读模式
本帖最后由 tcpuuu 于 2011-5-19 10:15 编辑

[img][/img]

Case $6Button
$edit2+=1
         GUICtrlSetData($n2,$edit2)
這有錯嗎?
按1次加1  為什麼都是+3
GUICreate(" Win ", 180, 520, 840, 0);寬;高;右;上 
拜託請幫我解決
[code]GUICreate(" Win ", 180, 520, 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)
$6Button = GUICtrlCreateButton("次數", 58,200, 50,26)
GUICtrlSetBkColor($6Button,0xC0C0C0)
$60Button = GUICtrlCreateButton("down", 80,410, 32,22)
$70Button = GUICtrlCreateButton("up"  , 80,434, 32,22)

$n1 = GUICtrlCreateInput("1",2,3,20,18)
$n2 = GUICtrlCreateInput("",58,228, 50, 24)

GUICtrlSetFont(-1, 12)
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)
GUICtrlCreateLabel("17", 7,414,14,12)
GUICtrlCreateLabel("18", 7,438,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, 0xFFFFFF)
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, 0xFF0000)
GUICtrlSetFont(-1, 12)

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

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

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

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

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

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

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



GUISetState()
Local $edit2=0
$bj = $L16;從L16開始
$N = $L18
$M = $L1
While 1
        $msg = GUIGetMsg()
        Switch $msg
                Case -3
                        Exit

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

Case $2Button
$N = $L23
$M = $L19
If $bj = $L23 Then ContinueLoop
GUICtrlSetBkColor($bj, 0xFFFFFF)
$bj = $L19
GUICtrlSetBkColor($L19, 0xFF0000)
GUICtrlSetBkColor($2Button, 0xFF0000)
GUICtrlSetBkColor($1Button,0xF6F6F2)
GUICtrlSetBkColor($3Button,0xF6F6F2)
GUICtrlSetBkColor($4Button,0xF6F6F2)
GUICtrlSetBkColor($5Button,0xF6F6F2)
GUICtrlSetData($n1,GUICtrlRead($bj))

Case $6Button
$edit2+=1
         GUICtrlSetData($n2,$edit2)        



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

Case $70Button
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

本帖子中包含更多资源

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

×
发表于 2011-5-19 11:34:09 | 显示全部楼层
本帖最后由 ssjoe 于 2011-5-19 11:35 编辑

能否说清楚点?
如果是说次数按下去+1那我这测试是正常的,没有你所说的按一次+3
发表于 2011-5-19 12:03:37 | 显示全部楼层
还是一样,没有像你所说的,按一次+3都是正常+1
你自己编译后看看还会不会像你所说的那样吧!
 楼主| 发表于 2011-5-19 12:10:53 | 显示全部楼层
本帖最后由 tcpuuu 于 2011-5-19 13:15 编辑

我發現  真是見鬼了........?
最上面  如果是  1行  GUICreate(" Win ", 180, 520, 840, 0)  按下去  是3
如果是2行
GUICreate(" Win ", 180, 520, 840, 0)
GUICreate(" Win ", 180, 520, 840, 0)

按下去  就正確  是1

$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)
$6Button = GUICtrlCreateButton("次數", 58,200, 50,26)
GUICtrlSetBkColor($6Button,0xC0C0C0)
$60Button = GUICtrlCreateButton("down", 80,410, 32,22)
$70Button = GUICtrlCreateButton("up"  , 80,434, 32,22)

$n1 = GUICtrlCreateInput("1",2,3,20,18)
$n2 = GUICtrlCreateInput("",58,228, 50, 24)
-------------------------------------------------------------------------------
真的很奇怪   怎麼檢查 代碼?
发表于 2011-5-19 12:30:29 | 显示全部楼层
楼主检查一下自己的代码,是不是多加了啊。。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-12-22 11:41 , Processed in 0.075985 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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