#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#include <Timers.au3>
;Global $Sec = 0
;Global $Min = 1
Local $sec = 0, $min = 1
$mainwindow = GUICreate("倒计时 ", 162, 82, 400, 300, BitOR($WS_POPUP, $WS_CLIPSIBLINGS))
$Label = GUICtrlCreateLabel("标签", 0, 0, 162, 82, $SS_BLACKFRAME, $GUI_WS_EX_PARENTDRAG) ;通过右键菜单退出-拖拽
;FileInstall("tu.jpg", @TempDir & "\") ;编译图片
;$Pic1 = GUICtrlCreatePic(@TempDir & "\tu.jpg", 0, 0, 162, 82)
$FontMin = GUICtrlCreateLabel(StringFormat('%02s', $min), 22, 2, 48, 39)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xc24343)
GUICtrlSetFont(-1, 34, 400, 0, "@黑体")
$FontD = GUICtrlCreateLabel(":", 68, 2, 48, 39)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xc24343)
GUICtrlSetFont(-1, 34, 400, 0, "@黑体")
$FontSec = GUICtrlCreateLabel(StringFormat('%02s', $sec) & ":", 90, 2, 48, 39)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xc24343)
GUICtrlSetFont(-1, 34, 400, 0, "@黑体")
$contextmenu = GUICtrlCreateContextMenu(3)
$Start = GUICtrlCreateMenuItem("开始", $contextmenu)
$Abort = GUICtrlCreateMenuItem("关于", $contextmenu)
GUICtrlCreateMenuItem("", $contextmenu)
$infoitem = GUICtrlCreateMenuItem("退出", $contextmenu)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3, $infoitem ; 退出
infoitem()
Case $Start
_Timer_SetTimer($mainwindow, 1000, "_UpdateStatusBarClock")
$sec = 0
$min = 1
GUICtrlSetState($start,$GUI_DISABLE)
EndSwitch
WEnd
Func _UpdateStatusBarClock($hWnd, $Msg, $iIDTimer, $dwTime)
If $sec = 0 And $min = 0 Then
_Timer_KillAllTimers($mainwindow)
GUICtrlSetState($start,$GUI_ENABLE)
Else
If $sec <= 0 Then
$sec = 60 + $sec
$min -= 1
EndIf
$sec -= 1
GUICtrlSetData($FontMin, StringFormat('%02s', $min))
GUICtrlSetData($FontSec, StringFormat('%02s', $sec))
EndIf
EndFunc ;==>_UpdateStatusBarClock
Func infoitem()
FileDelete(@TempDir & "\tu.jpg") ;删除图片
Exit
EndFunc ;==>infoitem
|