Function Reference


_GUICtrlDTP_GetMCColor

Retrieves the specified color

#include <GuiDateTimePicker.au3>
_GUICtrlDTP_GetMCColor ( $hWnd, $iIndex )

Parameters

$hWnd Handle to the control
$iIndex Indicates which month calendar color to retrieve:
    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

Return Value

Success: the color setting for the specified portion of the control.
Failure: -1.

Related

_GUICtrlDTP_SetMCColor

Example

#include <ColorConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiDateTimePicker.au3>
#include <MsgBoxConstants.au3>

Global $g_idMemo

Example() ;use autoit built-in control

Func Example()
    Local $hDTP

    ; Create GUI
    GUICreate("DateTimePick Get Month Calendar Color", 400, 300)
    $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_MONEYGREEN)

    ; 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