CMonthCalCtrl::SetColor

设置month calendar控件的指定范围的颜色。

COLORREF SetColor(
   int nRegion,
   COLORREF ref 
);

参数

  • nRegion
    指定哪个月历颜色的整数值设置为。 该值可以是一个下面。

    含义

    MCSC_BACKGROUND

    背景颜色显示在月份之间。

    MCSC_MONTHBK

    月份中显示的背景色。

    MCSC_TEXT

    用于显示月份中文本的颜色。

    MCSC_TITLEBK

    日历标题中显示的背景色。

    MCSC_TITLETEXT

    用于显示日历标题中文本的颜色。

    MCSC_TRAILINGTEXT

    使用的颜色显示标头和后缀日文本。 标头和尾随日期是日从以前和出现在当前日历的月后。

  • ref
    设置为month calendar控件的指定部分的新颜色的一个 COLORREF 值。

返回值

表示设置为month calendar控件的指定部分的前一个颜色的 COLORREF 值,因此,如果成功。 否则此消息返回-1。

备注

此成员函数实现Win32消息 MCM_SETCOLOR的行为,如 Windows SDK所述。

示例

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

要求

Header: afxdtctl.h

请参见

参考

CMonthCalCtrl选件类

层次结构图

CMonthCalCtrl::GetColor