本帖最后由 虫子樱桃 于 2017-4-13 08:50 编辑
;===============================================================================
; Function Name: _GetHexMask($sDays [, $Delim=Default])
; Description: creates mask to mark days with _GUICtrlMonthCal_SetDayState in MonthCal
; Parameter(s): $sDays string with days to mark
; $Delim delimiter in string, 'Default' (char from 'GUIDataSeparatorChar')
; Return Value(s): Hexstring for $aMasks
; Author(s): BugFix (bugfix@autoit.de)
;===============================================================================
Func _GetHexMask($sDays, $Delim=Default)
If $Delim = Default Then $Delim = Opt('GUIDataSeparatorChar')
$aDays = StringSplit($sDays, $Delim, 2)
Local $aHex[8] = [0,0,0,0,0,0,0,0], $pos, $out = ''
For $i = 0 To UBound($aDays) -1
Select
Case $aDays[$i] < 5
$pos = 0
Case $aDays[$i] < 9
$pos = 1
Case $aDays[$i] < 13
$pos = 2
Case $aDays[$i] < 17
$pos = 3
Case $aDays[$i] < 21
$pos = 4
Case $aDays[$i] < 25
$pos = 5
Case $aDays[$i] < 29
$pos = 6
Case Else
$pos = 7
EndSelect
$aDays[$i] -= $pos * 4
$aHex[$pos] += 2 ^ ($aDays[$i]-1)
Next
For $i = 0 To UBound($aHex) -1
$out = Hex($aHex[$i], 1) & $out
Next
Return '0x' & $out
EndFunc ;==>_GetHexMask
#include <GuiConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
Opt('MustDeclareVars', 1)
Global $Debug_MC = False; Check ClassName being passed to MonthCal functions, set to True and use a handle to another control to see it work
_ThemeLevel(1)
Global $iMemo
_Main()
Func _Main()
Local $hMonthCal
; Create GUI
GUICreate("Month Calendar Set Color", 400, 300)
$hMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, $WS_BORDER, 0x00000000)
; Create memo control
$iMemo = GUICtrlCreateEdit("", 4, 168, 392, 128, 0)
GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
GUISetState()
; Get/Set calendar color
MemoWrite("Background: 0x" & Hex(_GUICtrlMonthCal_GetColor($hMonthCal, $MCSC_MONTHBK), 6))
_GUICtrlMonthCal_SetColor($hMonthCal, $MCSC_MONTHBK, $CLR_MONEYGREEN)
MemoWrite("Background: 0x" & Hex(_GUICtrlMonthCal_GetColor($hMonthCal, $MCSC_MONTHBK), 6))
; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main
; Write message to memo
Func MemoWrite($sMessage)
GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite
; Functionality :
; just info about possibility to turn off theme-using in scripts/compiled-exe with using GUI stuff
; This info was produced by Holger
Func _ThemeLevel($nFlag = 0)
; $nFlag = 0 ; Visual styles are completely disabled in the running script
; $nFlag = 1; Nonclient areas of the GUI can use visual styles
; $nFlag = 2; Controls can use visual styles (like Buttons, Progressbar, Group-ctrl's, etc.)
; $nFlag = 4; Web content displayed ??? (info from MSDN) can use visual styles
;
; These flags can be combined with BitOr(...)
DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", $nFlag)
EndFunc ;==>_ThemeLevel
|