你加上不就行了嘛,这个都还要‘这样更好了’…………
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <MenuConstants.au3>
#include <WinAPI.au3>
$hgui = GUICreate("Timer show", 285, 80, -1, -1, BitOR($WS_SYSMENU, $WS_POPUP), BitOR($WS_EX_LAYERED,$WS_EX_TOPMOST), WinGetHandle(AutoItWinGetTitle()))
GUISetFont(50, 800)
$nHourLabel = GUICtrlCreateLabel('', 0, 0, 100, 80)
GUIctrlSetBkColor(-1,0xFFFFFF)
$nMinLabel = GUICtrlCreateLabel('', 100, 0, 100, 80)
GUIctrlSetBkColor(-1,0xFFFFFF)
$nSecALabel = GUICtrlCreateLabel('', 200, 0, 40, 80)
GUIctrlSetBkColor(-1,0xFFFFFF)
$nSecBLabel = GUICtrlCreateLabel('', 235, 0, 50, 80)
GUIctrlSetBkColor(-1,0xFFFFFF)
GUISetState(@SW_SHOW, $hgui)
_WinAPI_SetLayeredWindowAttributes($hGUI, 0xFFFFFF, 255)
AdlibRegister("_Timer", 1000)
While True
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $GUI_EVENT_PRIMARYDOWN
_SendMessage($hGUI, $WM_SYSCOMMAND, $SC_MOVE + $HTCAPTION, 0)
EndSwitch
WEnd
Func _Timer()
Local Static $iSecA, $iSecB, $iMin, $iHour
If StringTrimRight(@SEC, 1) <> $iSecA Then
GUICtrlSetData($nSecALabel, StringTrimRight(@SEC, 1))
$iSecA = StringTrimRight(@SEC, 1)
EndIf
If StringTrimLeft(@SEC, 1) <> $iSecB Then
GUICtrlSetData($nSecBLabel, StringTrimLeft(@SEC, 1))
$iSecB = StringTrimLeft(@SEC, 1)
EndIf
If @MIN <> $iMin Then
GUICtrlSetData($nMinLabel,@MIN & ':')
$iMin = @MIN
EndIf
If @HOUR <> $iHour Then
GUICtrlSetData($nHourLabel,@HOUR & ':')
$iHour = @HOUR
EndIf
EndFunc
我的代码如下:Local $Dtime,$Date
GUICreate("Timer show", 300, 100)
GUISetFont(50, 800)
_DT()
GUISetState()
Do
Until GUIGetMsg() == -3
Func _DT()
GUISetFont(18, 800, 1)
$Date = GUICtrlCreateLabel(@YEAR & "-" & @MON & "-" & @MDAY & " " &@HOUR & ":" & @MIN & ":" & @SEC , 10, 10, 250, 25)
;GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0x0B1746)
AdlibRegister("date", 1000)
EndFunc
Func date()
Dim $Dtime = GUICtrlSetData($Date, @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC)
EndFunc使用后会出现闪动的现象,原理与上面的两位是一样的,只是采集的方式有所不同 最后一位好且实用 方便! 太好了,14楼,7楼的方法 太好了,14楼,7楼的方法 用GDI比较好点 还是想看看楼主的代码,好分析问题 顶14楼代码 happytc 发表于 2013-2-25 21:27
回复 7# 3mile
拖动窗口时间会停,请问有没有解决方法? #include <Date.au3>
Local $Dtime,$Date
GUICreate("Timer show", 300, 100)
GUISetFont(50, 800)
_DT()
GUISetState()
Do
Until GUIGetMsg() == -3
Func _DT()
GUISetFont(18, 800, 1)
$Date = GUICtrlCreateLabel('' , 10, 10, 250, 25)
;GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0x0B1746)
AdlibRegister("date", 50)
EndFunc
Func date()
Local Static $g_sTime
Local $sTime = $g_sTime
$g_sTime = _Now()
If $sTime <> $g_sTime Then GUICtrlSetData($Date, $g_sTime)
EndFunc
页:
1
[2]