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 <ColorConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiMonthCal.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>

Global $g_idMemo

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
        $g_idMemo = GUICtrlCreateEdit("", 4, 168, 417, 128, BitOR($WS_VSCROLL, $ES_MULTILINE))
        GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New")
        GUICtrlSendMsg($g_idMemo, $EM_SETREADONLY, True, 0)
        GUICtrlSetBkColor($g_idMemo, 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

; Write message to memo
Func MemoWrite($sMessage)
        GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite