本帖最后由 C.L 于 2010-1-22 11:10 编辑
我做了一个,算法不算好,只是起演示功能#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("时间输入框", 150, 60, 192, 124)
$Input1 = GUICtrlCreateInput("23:59:58", 20, 10, 60, 21)
$Input2 = GUICtrlCreateInput("0", 86, 10, 10, 21)
$Updown1 = GUICtrlCreateUpdown($Input2)
GUISetState(@SW_SHOW)
GUICtrlSetState($input2,$gui_hide)
While 1
If GUICtrlRead ($input2)>2 Or GUICtrlRead ($input2)<-1 Then GUICtrlSetData($input2,0)
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Updown1
$num = GUICtrlRead($input2)
$time = StringSplit(GUICtrlRead($input1),":")
_input_time ()
EndSwitch
WEnd
Func _input_time ()
Switch $time [3]
Case 1 to 59
$time [3] = $time[3]+$num
If $time[3]=60 Then
$time [3] = 0
$time [2] += 1
EndIf
If $time [2]= 60 Then
$time [2] = 0
$time [1] += 1
EndIf
Case -100 to 0
If $num = -1 Then
$time[3]=59
$time[2]+= $num
If $time[2]<0 Then
$time[2]=59
$time [1] -=1
EndIf
EndIf
If $num = 1 Then
$time[3] += $num
EndIf
Case 60 to 1500
$time[3]=0
$time[2]+=1
EndSwitch
If $time[1] = 24 Then
For $i=1 to 3
$time[$i]= 0
Next
EndIf
If $time[1] < 0 Then
$time[1] = 23
For $i=2 to 3
$time[$i]= 59
Next
EndIf
If stringlen($time[3])=1 Then $time[3] = "0"&$time[3]
If stringlen($time[2])=1 Then $time[2] = "0"&$time[2]
If stringlen($time[1])=1 Then $time[1] = "0"&$time[1]
GUICtrlSetData ($input1,$time[1]&":"&$time[2]&":"&$time[3])
GUICtrlSetData ($input2,"0")
EndFunc
|