#NoTrayIcon
#include <Process.au3>
#include <WinAPIProc.au3>
#include <ftpex.au3>
#include <WinAPI.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <winapi.au3>
$WinMain = GUICreate("WinMain", @DesktopWidth, @DesktopHeight, -1, -1, $WS_POPUP)
$Wallpaper = GUICtrlCreatePic(@ScriptDir & "/back0.jpg", 0, 0, @DesktopWidth, @DesktopHeight)
GUICtrlSetState($Wallpaper, $GUI_DISABLE)
$text1 = GUICtrlCreateLabel('桌面日历', @DesktopWidth/2-70, 30, 150, 50)
GUICtrlSetFont(-1, 24, 800, 0, "微软雅黑")
GUICtrlSetBkColor(-1, -2)
$ButtonA1 = GUICtrlCreateButton('退出', @DesktopWidth/2-50, 700, 100, 35)
_WinAPI_SetWindowLong($WinMain, $GWL_HWNDPARENT, WinGetHandle("Program Manager"));此语句实现窗口不被最小化
GUISetState(@SW_SHOW, $WinMain)
Global $aWeekName[7] = ["日", "一", "二", "三", "四", "五", "六"]
Global $aDayName[43]
Global $hFocusText
;$WinMainSubRL = GUICreate("日历控件",220,160,@DesktopWidth-220,30,$WS_POPUP,$WS_EX_MDICHILD,$WinMain);不被背景图片遮挡
$WinMainSubRL = GUICreate("日历控件", 220, 160, @DesktopWidth - 220, 10, $WS_CHILD, $WS_EX_LAYERED, $WinMain);不被背景图片遮挡
Global $hCalendarText = GUICtrlCreateLabel(GetDate(), @DesktopWidth - 230, 30, 240, 25)
GUICtrlSetFont(-1, 14, 400, 0, "微软雅黑")
GUICtrlSetColor(-1, 0xFEFEFE)
GUICtrlSetBkColor(-1, -2)
For $i = 0 To 6
GUICtrlCreateLabel($aWeekName[$i], @DesktopWidth - 235 + $i * 30, 60, 25, 22, $SS_CENTER)
;GUICtrlSetFont(-1, 16, 800)
GUICtrlSetFont(-1, 12, 600, 0, "微软雅黑")
;GUICtrlSetColor(-1,0xFEFEFE);周一-周日颜色
GUICtrlSetColor(-1, 0x990000);0x4682B4);周一-周日颜色
GUICtrlSetBkColor(-1, -2)
Next
Local $k = 1
For $i = 1 To 6
For $j = 0 To 6
$aDayName[$k - 1] = GUICtrlCreateLabel("", @DesktopWidth - 235 + $j * 30, 60 + $i * 20, 25, 22, $SS_CENTER)
;GUICtrlSetFont(-1, 16, 800)
GUICtrlSetFont(-1, 12, 400, 0, "微软雅黑")
GUICtrlSetColor(-1, 0xFEFEFE)
GUICtrlSetBkColor(-1, -2)
$k += 1
Next
Next
SetCalendar(@YEAR, @MON)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE, $ButtonA1
Exit
EndSwitch
Sleep(100)
WEnd
Func SetCalendar($iYear, $iMonth)
If $iYear < 999 Or $iYear > 9998 Or $iMonth < 1 And $iMonth > 12 Then Return False
Local $k = 1, $l = 0, $iWeekday = _DateToDayOfWeek($iYear, $iMonth, 1)
Local $iDays = _DateDaysInMonth($iYear, $iMonth)
For $i = 1 To 6
For $j = 0 To 6
If $k >= $iWeekday And $l < $iDays Then
$l += 1
GUICtrlSetData($aDayName[$k - 1], $l)
Else
GUICtrlSetData($aDayName[$k - 1], "")
EndIf
If @YEAR = $iYear And @MDAY = $l And @MON = $iMonth Then
GUICtrlSetColor($aDayName[$k - 1], 0xfbfcfd);0x4682B4);当天的颜色0xFFA0A0
GUICtrlSetBkColor($aDayName[$k - 1], 0x990000)
Else
GUICtrlSetColor($aDayName[$k - 1], 0xfbfcfd);0xFEFEFE);每天的颜色
EndIf
$k += 1
Next
Next
Return True
EndFunc ;==>SetCalendar
Func GetDate()
Return (@YEAR & " 年 " & @MON & " 月 " & @MDAY & " 日 ")
EndFunc ;==>GetDate
|