CMonthCalCtrl::SetColor

COLORREF SetColor( int nRegion, COLORREF ref );

Return Value

A COLORREF value that represents the previous color setting for the specified portion of the month calendar control, if successful. Otherwise this message returns -1.

Parameters

nRegion

An integer value specifying which month calendar color to set. This value can be one of the following.

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

ref

A COLORREF value for the new color setting for the specified portion of the month calendar control.

Remarks

This member function implements the behavior of the Win32 message MCM_SETCOLOR, as described in the Platform SDK.

Example

void CDatesDlg::OnButton2() 
{
   // Gain a pointer to the control
   CMonthCalCtrl* pCtrl = (CMonthCalCtrl*) GetDlgItem(IDC_MONTHCALENDAR1);

   // Set colors for title text and title background to match
   // the Control Panel settings for inactive window captions.
   pCtrl->SetColor(MCSC_TITLETEXT, ::GetSysColor(COLOR_INACTIVECAPTIONTEXT));
   pCtrl->SetColor(MCSC_TITLEBK, ::GetSysColor(COLOR_INACTIVECAPTION));
}

CMonthCalCtrl OverviewClass MembersHierarchy Chart

See Also   CMonthCalCtrl::GetColor