Sets the color for a given portion of the month calendar
#include <GuiDateTimePicker.au3>
_GUICtrlDTP_SetMCColor ( $hWnd, $iIndex, $iColor )
$hWnd | Handle to the control |
$iIndex | Indicates which month calendar color to set: 0 - Background color displayed between months 1 - Color used to display text within a month 2 - Background color displayed in the calendar title 3 - Color used to display text within the calendar title 4 - Background color displayed within the month 5 - Color used to display header day and trailing day text |
$iColor | The color that will be set for the specified area |
Success: | the previous color for the given portion. |
Failure: | -1. |
#include <ColorConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiDateTimePicker.au3>
#include <MsgBoxConstants.au3>
Global $g_idMemo
Example() ;use autoit built-in control
Func Example()
; Create GUI
GUICreate("DateTimePick Get/Set MCColor (v" & @AutoItVersion & ")", 400, 300)
Local $hDTP = GUICtrlGetHandle(GUICtrlCreateDate("", 2, 6, 190))
$g_idMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New")
GUISetState(@SW_SHOW)
; Set the display format
_GUICtrlDTP_SetFormat($hDTP, "ddd MMM dd, yyyy hh:mm ttt")
; Set month calendar background color
_GUICtrlDTP_SetMCColor($hDTP, 2, $CLR_DARKSEAGREEN)
; Get DTP colors
MemoWrite("Background between months: " & "0x" & Hex(_GUICtrlDTP_GetMCColor($hDTP, 0), 6))
MemoWrite("Text within months ......: " & "0x" & Hex(_GUICtrlDTP_GetMCColor($hDTP, 1), 6))
MemoWrite("Title background ........: " & "0x" & Hex(_GUICtrlDTP_GetMCColor($hDTP, 2), 6))
MemoWrite("Title text ..............: " & "0x" & Hex(_GUICtrlDTP_GetMCColor($hDTP, 3), 6))
MemoWrite("Background within months : " & "0x" & Hex(_GUICtrlDTP_GetMCColor($hDTP, 4), 6))
MemoWrite("Header trailing .........: " & "0x" & Hex(_GUICtrlDTP_GetMCColor($hDTP, 5), 6))
; Loop until the user exits.
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>Example
; Write a line to the memo control
Func MemoWrite($sMessage)
GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1)
EndFunc ;==>MemoWrite