找回密码
 加入
搜索
查看: 2021|回复: 1

[GUI管理] 請問 成立 簡短的寫法(還有1個未解決)

[复制链接]
发表于 2012-8-19 00:37:55 | 显示全部楼层 |阅读模式
本帖最后由 tcpuuu 于 2012-8-20 18:50 编辑

IF GUICtrlRead($A2[1])-GUICtrlRead($A2[2]) > 0 THEN
GUICtrlSetColor($A2[1],0xFF0000);紅色
GUICtrlSetColor($A2[2],0xFF0000);紅色
ENDIF

IF GUICtrlRead($A2[1])-GUICtrlRead($A2[2]) < 0 THEN
GUICtrlSetColor($A2[1],0x008000);
GUICtrlSetColor($A2[2],0x008000);
ENDIF

IF GUICtrlRead($A2[3])-GUICtrlRead($A2[4]) > 0 THEN
GUICtrlSetColor($A2[3],0xFF0000);紅色
GUICtrlSetColor($A2[4],0xFF0000);紅色
ENDIF

IF GUICtrlRead($A2[3])-GUICtrlRead($A2[4]) < 0 THEN
GUICtrlSetColor($A2[3],0x008000);
GUICtrlSetColor($A2[4],0x008000);
ENDIF

IF GUICtrlRead($A2[7])-GUICtrlRead($A2[8]) > 0 THEN
GUICtrlSetColor($A2[7],0xFF0000);紅色
GUICtrlSetColor($A2[8],0xFF0000);紅色
ENDIF

IF GUICtrlRead($A2[7])-GUICtrlRead($A2[8]) < 0 THEN
GUICtrlSetColor($A2[7],0x008000);
GUICtrlSetColor($A2[8],0x008000);
ENDIF
========================
1-2>0  1 AND 2  都變 紅色
1-2<0  1 AND 2  都變 綠色

1-2 = 0  就不管它
==================================================================

$Volume+=1
IF $Volume = 1 then $ume = 14.9
IF $Volume = 2 then $ume = 9.48
IF $Volume = 3 then $ume = 7.12
IF $Volume = 4 then $ume = 5.83
IF $Volume = 5 then $ume = 4.99
IF $Volume = 6 then $ume = 4.42
IF $Volume = 7 then $ume = 3.99
IF $Volume = 8 then $ume = 3.66
IF $Volume = 9 then $ume = 3.39
IF $Volume = 10 then $ume = 3.18
IF $Volume = 11 then $ume = 2.99
IF $Volume = 12 then $ume = 2.83
IF $Volume = 13 then $ume = 2.7
IF $Volume = 14 then $ume = 2.58
IF $Volume = 15 then $ume = 2.48
IF $Volume = 16 then $ume = 2.39
IF $Volume = 17 then $ume = 2.3
IF $Volume = 18 then $ume = 2.23
IF $Volume = 19 then $ume = 2.15
IF $Volume = 20 then $ume = 2.09
IF $Volume = 21 then $ume = 2.03
IF $Volume = 22 then $ume = 1.97
IF $Volume = 23 then $ume = 1.92
IF $Volume = 24 then $ume = 1.87
IF $Volume = 25 then $ume = 1.83
IF $Volume = 26 then $ume = 1.79
IF $Volume = 27 then $ume = 1.74
IF $Volume = 28 then $ume = 1.71
IF $Volume = 29 then $ume = 1.67
IF $Volume = 30 then $ume = 1.63
IF $Volume = 31 then $ume = 1.6
IF $Volume = 32 then $ume = 1.57
IF $Volume = 33 then $ume = 1.54
IF $Volume = 34 then $ume = 1.51
IF $Volume = 35 then $ume = 1.48
IF $Volume = 36 then $ume = 1.46
IF $Volume = 37 then $ume = 1.43
IF $Volume = 38 then $ume = 1.41
IF $Volume = 39 then $ume = 1.38
IF $Volume = 40 then $ume = 1.36
IF $Volume = 41 then $ume = 1.34
IF $Volume = 42 then $ume = 1.32
IF $Volume = 43 then $ume = 1.3
IF $Volume = 44 then $ume = 1.28
IF $Volume = 45 then $ume = 1.25
IF $Volume = 46 then $ume = 1.23
IF $Volume = 47 then $ume = 1.21
IF $Volume = 48 then $ume = 1.19
IF $Volume = 49 then $ume = 1.17
IF $Volume = 50 then $ume = 1.14
IF $Volume = 51 then $ume = 1.12
IF $Volume = 52 then $ume = 1.09
IF $Volume = 53 then $ume = 1.06
IF $Volume = 54 then $ume = 1
IF $Volume = 55 then $ume = 1
IF $Volume = 56 then $ume = 1
GUICtrlSetData($WEL[9],Round($ARS1*$ume/10000,2))

$ume 後面 小數點 的 數值  都 沒有規律性  有簡短1點的 寫法嗎?
发表于 2012-8-19 01:24:33 | 显示全部楼层

Local $index[6] = [1, 2, 3, 4, 7, 8]
Local $color[2] = [0x008000, 0xFF0000]
Local $n
Local $m
For $i = 0 To 2
        $n = Number(GUICtrlRead($A2[$index[2*$i])) - Number(GUICtrlRead($A2[$index[2*$i+1]))  
        $m = Floor(($n+abs($n))/(2*abs($n)))
        If $n Then
                GUICtrlSetColor($A2[$index[2*$i]], $color[$m]);
                GUICtrlSetColor($A2[$index[2*$i+1]], $color[$m]);
        EndIf
Next

评分

参与人数 1金钱 +30 收起 理由
tcpuuu + 30 嗯! 完全正確

查看全部评分

您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-12-27 11:02 , Processed in 0.071704 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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