當前位置:編程學習大全網 - 編程軟體 - 時間加減計算的代碼?

時間加減計算的代碼?

; AutoIt源代碼

#include <ButtonConstants.au3>

#include <DateTimeConstants.au3>

#include <EditConstants.au3>

#include <GUIConstantsEx.au3>

#include <WindowsConstants.au3>

#include <Date.au3>

#NoTrayIcon

#Region ### START Koda GUI section ### Form=

$Form1 = GUICreate("時間加減計算工具", 392, 246, 192, 114)

$Date1 = GUICtrlCreateDate("", 40, 40, 80, 30, $DTS_TIMEFORMAT)

$Input1 = GUICtrlCreateInput("95", 200, 45, 60, 25)

$Radio1 = GUICtrlCreateRadio("減", 48, 104, 33, 17)

GUICtrlSetState($Radio1, $GUI_CHECKED)

$Radio2 = GUICtrlCreateRadio("加", 112, 104, 33, 17)

$Date2 = GUICtrlCreateDate("", 40, 160, 80, 30, $DTS_TIMEFORMAT)

$Button1 = GUICtrlCreateButton("計算", 200, 104, 73, 33)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

$t1 = ""

$t2 = ""

$sign = -1

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Case $Button1

If "" = GUICtrlRead($Input1) Then

MsgBox(16, "錯誤", "請輸入時間差")

Else

$min = Number(GUICtrlRead($Input1))

$t1 = GUICtrlRead($Date1)

If $GUI_CHECKED = GUICtrlRead($Radio1) Then

$sign = -1

EndIf

If $GUI_CHECKED = GUICtrlRead($Radio2) Then

$sign = 1

EndIf

$t2 = _DateAdd('n', $sign*$min, @YEAR & "/" & @MON & "/" & @MDAY & " " & $t1)

GUICtrlSetData($Date2, $t2)

EndIf

EndSwitch

WEnd

  • 上一篇:火影忍者手遊怎麽微信登錄
  • 下一篇:狄利克雷分布是個啥東西?最近看的關於文檔分類和主題建模方面的論文中看到的運用了LDA模型,就是這個模型
  • copyright 2024編程學習大全網