[已解決]挑選 4 5 6裡的最大值寫入 15 16 17(求助該如何改ㄚ?)
本帖最后由 tcpuuu 于 2010-10-3 22:12 编辑GUICreate('COM', 138, 200, 880, 2)
$L1 = GUICtrlCreateInput('', 1, 20, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$L2 = GUICtrlCreateInput('', 34, 20, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$L3 = GUICtrlCreateInput('', 67, 20, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$L4 = GUICtrlCreateInput('', 1, 46, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFff)
GUICtrlSetFont(-1, 12)
$L5 = GUICtrlCreateInput('', 34, 46, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$L6 = GUICtrlCreateInput('', 67, 46, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$L7 = GUICtrlCreateInput('', 1, 46, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFff)
GUICtrlSetFont(-1, 12)
$L8 = GUICtrlCreateInput('', 34, 46, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$L9 = GUICtrlCreateInput('', 67, 46, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$L10 = GUICtrlCreateInput('', 1, 46, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFff)
GUICtrlSetFont(-1, 12)
$L11 = GUICtrlCreateInput('', 34, 46, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$L12 = GUICtrlCreateInput('', 67, 46, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$L13 = GUICtrlCreateInput('', 1, 46, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFff)
GUICtrlSetFont(-1, 12)
$L14 = GUICtrlCreateInput('', 34, 46, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$L15 = GUICtrlCreateInput('', 1, 72, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFff)
GUICtrlSetFont(-1, 12)
$L16 = GUICtrlCreateInput('', 34, 72, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$L17 = GUICtrlCreateInput('', 67, 72, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$Button1 = GUICtrlCreateButton('挑選最大值', 2, 150, 120, 25)
GUISetState()
While 1
$msg = GUIGetMsg()
Switch $msg
Case -3
Exit
Case $Button1
_Max()
EndSwitch
WEnd
Func _Max()
Local $v1 = Number(GUICtrlRead($L4))
Local $v2 = Number(GUICtrlRead($L5))
Local $v3 = Number(GUICtrlRead($L6))
Local $max = $v1, $x = 1, $i
For $i = 5 To 6
If Eval('v' & $i) >= $max Then
$max = Eval('v' & $i)
$x = $i
EndIf
Next
For $i = 15 To 17
GUICtrlSetData(Eval('L' & $i), '')
Next
GUICtrlSetData(Eval('L' & $x + 11), 1)
EndFunc ;==>_max
----------------------------------------------------------------------
挑選 456裡的最大值寫入 15 16 17
没明白什么意思,另外把代码里的空行整理下,留那么多行存银子呀? http://www.autoitx.com/forum.php?mod=redirect&goto=findpost&ptid=18716&pid=210412&fromuid=7644923 http://www.autoitx.com/redirect. ... amp;fromuid=7644923
------------------------------------------------------------------------------
我已改過但是有錯誤
有錯誤! GUICreate('COM', 500, 500, 180, 500)
$L1 = GUICtrlCreateInput('', 1, 20, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$L2 = GUICtrlCreateInput('', 34, 20, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$L3 = GUICtrlCreateInput('', 67, 20, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$L4 = GUICtrlCreateInput('', 1, 46, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFff)
GUICtrlSetFont(-1, 12)
$L5 = GUICtrlCreateInput('', 34, 46, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$L6 = GUICtrlCreateInput('', 67, 46, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$L7 = GUICtrlCreateInput('', 1, 66, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFff)
GUICtrlSetFont(-1, 12)
$L8 = GUICtrlCreateInput('', 34,66, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$L9 = GUICtrlCreateInput('', 67, 66, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$L10 = GUICtrlCreateInput('', 1, 86, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFff)
GUICtrlSetFont(-1, 12)
$L11 = GUICtrlCreateInput('', 34, 86, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$L12 = GUICtrlCreateInput('', 67, 86, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$L13 = GUICtrlCreateInput('', 1, 106, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFff)
GUICtrlSetFont(-1, 12)
$L14 = GUICtrlCreateInput('', 34, 106, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$L15 = GUICtrlCreateInput('', 67 ,106, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFff)
GUICtrlSetFont(-1, 12)
$L16 = GUICtrlCreateInput('', 1, 126, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$L17 = GUICtrlCreateInput('', 34, 126, 32, 22, 0x008000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlSetFont(-1, 12)
$Button1 = GUICtrlCreateButton('挑選最大值', 2, 150, 120, 25)
GUISetState()
While 1
$msg = GUIGetMsg()
Switch $msg
Case -3
Exit
Case $Button1
_Max()
EndSwitch
WEnd
Func _Max()
Local $v1 = Number(GUICtrlRead($L4))
Local $v2 = Number(GUICtrlRead($L5))
Local $v3 = Number(GUICtrlRead($L6))
Local $max = $v1, $x = 4, $i
For $i = 1 To 3
If Eval("v" & $i) >= $max Then
$max = Eval("v" & $i)
$x = $i
EndIf
Next
For $i = 15 To 17
GUICtrlSetData(Eval("L" & $i), '')
Next
$aa=$x+14
GUICtrlSetData(Eval("L" & $aa), $max)
EndFunc ;==>_max
页:
[1]