# Function Reference

# _GUICtrlMonthCal_GetColorArray

Retrieves the color for a given portion of a month calendar control

#include <GuiMonthCal.au3>
_GUICtrlMonthCal_GetColorArray ( $hWnd, $iColor )

## Parameters

$hWnd | Control ID/Handle to the control
$iColor | Value of type int specifying which month calendar color to retrieve This value can be one of the following: $MCSC_BACKGROUND - Retrieve the background color displayed between months. $MCSC_MONTHBK - Retrieve the background color displayed within the month. $MCSC_TEXT - Retrieve the color used to display text within a month. $MCSC_TITLEBK - Retrieve the background color displayed in the calendar's title. $MCSC_TITLETEXT - Retrieve the color used to display text within the calendar's title. $MCSC_TRAILINGTEXT - Retrieve the color used to display header day and trailing day text.

## Return Value

Success: | an array in the following format: [0] - contains the number returned [1] - contains COLORREF rgbcolor [2] - contains Hex BGR color [3] - contains Hex RGB color
Failure: | sets the @error flag to non-zero.

## Remarks

Header and trailing days are the days from the previous and following months that appear on the current month calendar.

## Related

_GUICtrlMonthCal_Create

## Example

    #include "Extras\HelpFileInternals.au3"

    #include <ColorConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <GuiMonthCal.au3>
    #include <WindowsStylesConstants.au3>

    Example()

    Func Example()
        Local $idMonthCal

        ; Create GUI
        GUICreate("Month Calendar Get Color Array", 425, 300)
        $idMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, $WS_BORDER, 0x00000000)

        ; Create memo control
        _MemoCreate(4, 168, 417, 128, BitOR($WS_VSCROLL, $ES_MULTILINE))
        GUICtrlSendMsg($_g_idLst_Memo, $EM_SETREADONLY, True, 0)
        GUICtrlSetBkColor($_g_idLst_Memo, 0xFFFFFF)
        GUISetState(@SW_SHOW)

        _GUICtrlMonthCal_SetColor($idMonthCal, $MCSC_MONTHBK, $CLR_DARKSEAGREEN)

        ; Get/Set calendar colors
        _MemoWrite(_FormatOutPut("Background color displayed between months:", _GUICtrlMonthCal_GetColorArray($idMonthCal, $MCSC_BACKGROUND)))
        _MemoWrite(_FormatOutPut(@CRLF & "Background color displayed within the month:", _GUICtrlMonthCal_GetColorArray($idMonthCal, $MCSC_MONTHBK)))
        _MemoWrite(_FormatOutPut(@CRLF & "Color used to display text within a month:", _GUICtrlMonthCal_GetColorArray($idMonthCal, $MCSC_TEXT)))
        _MemoWrite(_FormatOutPut(@CRLF & "Background color displayed in the calendar's title:", _GUICtrlMonthCal_GetColorArray($idMonthCal, $MCSC_TITLEBK)))
        _MemoWrite(_FormatOutPut(@CRLF & "Color used to display text within the calendar's title:", _GUICtrlMonthCal_GetColorArray($idMonthCal, $MCSC_TITLETEXT)))
        _MemoWrite(_FormatOutPut(@CRLF & "Color used to display header day and trailing day text:", _GUICtrlMonthCal_GetColorArray($idMonthCal, $MCSC_TRAILINGTEXT)))

        ; Loop until the user exits.
        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE
        GUIDelete()
    EndFunc   ;==>Example

    Func _FormatOutPut($sText, $aColors)
        Return $sText & _
                @CRLF & @TAB & "COLORREF rgbcolor:" & @TAB & $aColors[1] & _
                @CRLF & @TAB & "Hex BGR color:" & @TAB & @TAB & $aColors[2] & _
                @CRLF & @TAB & "Hex RGB color:" & @TAB & @TAB & $aColors[3]
    EndFunc   ;==>_FormatOutPut