# Function Reference

# _GUICtrlMonthCal_SetColor

Sets the color for a given portion of the month calendar

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

## Parameters

$hWnd | Control ID/Handle to the control
$iIndex | Indicates which month calendar color to set: $MCSC_BACKGROUND - Background color displayed between months $MCSC_TEXT - Color used to display text within a month $MCSC_TITLEBK - Background color displayed in the calendar title $MCSC_TITLETEXT - Color used to display text within the calendar title $MCSC_MONTHBK - Background color displayed within the month $MCSC_TRAILINGTEXT - Color used to display header day and trailing day text
$iColor | Color value

## Return Value

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

## Related

_GUICtrlMonthCal_GetColor

## Example

    #include "Extras\HelpFileInternals.au3"

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

    Example()

    Func Example()
        ; Create GUI
        GUICreate("Month Calendar Get/Set Color (v" & @AutoItVersion & ")", 400, 300)
        Local $idMonthCal = GUICtrlCreateMonthCal("", 4, 4, -1, -1, $WS_BORDER, 0x00000000)

        ; Create memo control
        _MemoCreate(4, 188, 392, 108, 0)
        GUISetState(@SW_SHOW)

        ; Get/Set calendar color
        _MemoWrite("Background: 0x" & Hex(_GUICtrlMonthCal_GetColor($idMonthCal, $MCSC_MONTHBK), 6))
        _GUICtrlMonthCal_SetColor($idMonthCal, $MCSC_TEXT, 0xB02B00)
        _GUICtrlMonthCal_SetColor($idMonthCal, $MCSC_TITLEBK, 0x5EFFFE)
        _GUICtrlMonthCal_SetColor($idMonthCal, $MCSC_TITLETEXT, 0x0000FF)
        _GUICtrlMonthCal_SetColor($idMonthCal, $MCSC_MONTHBK, 0x87C4FF)
        _GUICtrlMonthCal_SetColor($idMonthCal, $MCSC_TRAILINGTEXT, 0x997777)
        _MemoWrite("Background: 0x" & Hex(_GUICtrlMonthCal_GetColor($idMonthCal, $MCSC_MONTHBK), 6))

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