s77m72 发表于 2010-1-22 04:57:03

时间输入问题?

如何实现这样的攻能啊?

weeks1 发表于 2010-1-22 09:45:45

期待大侠们的出现

C.L 发表于 2010-1-22 10:12:36

好像默认没有这种功能,不过可以自已做

gapkiller 发表于 2010-1-22 10:44:12

本帖最后由 gapkiller 于 2010-1-22 10:45 编辑

自己做一个,也不难

C.L 发表于 2010-1-22 11:02:07

本帖最后由 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
                Case 1 to 59
                        $time = $time+$num
                        If $time=60 Then
                                $time = 0
                                $time += 1
                        EndIf
                        If $time = 60 Then
                                $time = 0
                                $time += 1
                        EndIf
                Case -100 to 0
                        If $num = -1 Then
                                $time=59
                                $time+= $num
                                If $time<0 Then
                                        $time=59
                                        $time -=1
                                EndIf
                        EndIf
                        If $num = 1 Then
                                $time += $num
                               
                        EndIf
                Case 60 to 1500
                        $time=0
                        $time+=1
        EndSwitch
        If $time = 24 Then
                For $i=1 to 3
                        $time[$i]= 0
                Next
        EndIf
        If $time < 0 Then
                $time = 23
                For $i=2 to 3
                        $time[$i]= 59
                Next
        EndIf
        If stringlen($time)=1 Then $time = "0"&$time
        If stringlen($time)=1 Then $time = "0"&$time
        If stringlen($time)=1 Then $time = "0"&$time
        GUICtrlSetData ($input1,$time&":"&$time&":"&$time)
        GUICtrlSetData ($input2,"0")
EndFunc

netegg 发表于 2010-1-22 13:59:08

本帖最后由 netegg 于 2010-1-22 14:00 编辑

楼上想复杂了
GUICtrlCreateDate("", 2, 6, 394, 24, BitOR($DTS_TIMEFORMAT, $DTS_UPDOWN))

C.L 发表于 2010-1-22 15:26:11

回复 6# netegg

学习了,我还真不知道有这个样式。

lxz 发表于 2010-1-22 19:09:06

学习了......

qixinwb 发表于 2010-1-26 12:20:15

:face (6):大虾与小虾就是 不一样

sanmoking 发表于 2010-1-26 13:48:29

楼上想复杂了
GUICtrlCreateDate("", 2, 6, 394, 24, BitOR($DTS_TIMEFORMAT, $DTS_UPDOWN))
netegg 发表于 2010-1-22 13:59 http://www.autoitx.com/images/common/back.gif


   此样式 需要添加如下代码:
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <DateTimeConstants.au3>

netegg 发表于 2010-1-26 13:58:12

回复 10# sanmoking

头两个不说了,做界面好像都需要,第三个是针对datetime控件的

pcbar 发表于 2010-1-26 14:58:05

本帖最后由 pcbar 于 2010-1-26 15:06 编辑

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <DateTimeConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 190, 98, 193, 125)
$date_2 = GUICtrlCreateDate("00:00:01", 10, 10, 80, 20, $DTS_TIMEFORMAT)
GUICtrlSetData(-1, @YEAR&'/'&@MON&'/'&@MDAY&' 00:19:35')
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
      $nMsg = GUIGetMsg()
      Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

      EndSwitch
WEnd

6FINGERS 发表于 2010-1-26 19:10:37

Pcbar大哥,好久不见了!
页: [1]
查看完整版本: 时间输入问题?