Function Reference

_GUICtrlMonthCalSetColor

Sets the color for a given portion of a month calendar control.

#Include <GuiMonthCal.au3>
_GUICtrlMonthCalSetColor($h_monthcal, $i_color, $i_colorref[, $i_refType = 0])

 

Parameters

$h_monthcal control id/control hWnd
$i_color Value of type int specifying which month calendar color to set.
$i_colorref Value that represents the color that will be set for the specified area of the month calendar.
$i_refType Optional: Type of value used for $i_colorref

 

Return Value

Success: Returns an array of the previous color setting for the specified portion of the month calendar control
Failure: Returns -1

 

Remarks

$i_color this value can be one of the following:

$MCSC_BACKGROUND Set the background color displayed between months.
$MCSC_MONTHBK Set the background color displayed within the month.
$MCSC_TEXT Set the color used to display text within a month.
$MCSC_TITLEBK Set the background color displayed in the calendar's title.
$MCSC_TITLETEXT Set the color used to display text within the calendar's title.
$MCSC_TRAILINGTEXT Set the color used to display header day and trailing day text.
Header and trailing days are the days from the previous and following
months that appear on the current month calendar.

    $i_refType = 0 $i_colorref is COLORREF rgbcolor (default)
    $i_refType = 1 $i_colorref is Hex BGR color
    $i_refType = 0 $i_colorref is Hex RGB color

Value returned:
    array[0] = number of elements
    array[1] = COLORREF rbgcolor
    array[2] = Hex BGR color
    array[3] = Hex RGB color

 

Related

_GUICtrlMonthCalGetColor

 

Example


#include <GUIConstants.au3>
#include <date.au3>
#include <GuiMonthCal.au3>

opt('MustDeclareVars', 1)

Dim $Date, $i, $a_colors, $Btn_Exit, $msg

GUICreate( "Set Color", 450, 254)

$Date = GUICtrlCreateMonthCal (_NowCalcDate(), 10, 10, 430, 160, 0, 0)

$Btn_Exit = GUICtrlCreateButton("Exit", 180, 180, 90, 30)

GUISetState()

; returns array of previous color if setcolor is successful
; 1 - COLORREF rgbcolor
; 2 - Hex BGR color
; 3 - Hex RGB color

; Set the background color displayed between months.
$a_colors = _GUICtrlMonthCalSetColor ($Date, $MCSC_BACKGROUND, 255)

;Set the background color displayed within the month.
$a_colors = _GUICtrlMonthCalSetColor ($Date, $MCSC_MONTHBK, 0xff0000, 1)

;Set the color used to display text within a month.
$a_colors = _GUICtrlMonthCalSetColor ($Date, $MCSC_TEXT, 0x00ffff, 1)

;Set the background color displayed in the calendar's title.
$a_colors = _GUICtrlMonthCalSetColor ($Date, $MCSC_TITLEBK, 0x000000, 2)

;Set the color used to display text within the calendar's title.
$a_colors = _GUICtrlMonthCalSetColor ($Date, $MCSC_TITLETEXT, 0xC0C0C0, 2)

;Set the color used to display header day and trailing day text.
$a_colors = _GUICtrlMonthCalSetColor ($Date, $MCSC_TRAILINGTEXT, 0xe6e6fa, 2)

While 1
   $msg = GUIGetMsg()
   Select
      Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
         ExitLoop
   EndSelect
WEnd