Share via


CMonthCalCtrl::SetMonthView

Sets the current month calendar control to display the month view.

BOOL SetMonthView();

Return Value

true if this method is successful; otherwise, false.

Remarks

This method uses the CMonthCalCtrl::SetCurrentView method to set the view to MCMV_MONTH, which represents the month view.

Requirements

Header: afxdtctl.h

This control is supported in Windows Vista and later.

Additional requirements for this method are described in Build Requirements for Windows Vista Common Controls.

Example

The following code example defines the variable, m_monthCalCtrl, that is used to programmatically access the month calendar control. This variable is used in the next example.

    // Variable used to reference the month calendar control.
    CMonthCalCtrl m_monthCalCtrl;
    // Variable used to reference the splitbutton control.
    CSplitButton m_splitButton;

The following code example sets the month calendar control to display the month, year, decade, and century views.

void CCMonthCalCtrl_s1Dlg::OnSetviewSetmonthview()
{
    m_monthCalCtrl.SetMonthView();
}

void CCMonthCalCtrl_s1Dlg::OnSetviewSetyearview()
{
    m_monthCalCtrl.SetYearView();
}

void CCMonthCalCtrl_s1Dlg::OnSetviewSetdecadeview()
{
    m_monthCalCtrl.SetDecadeView();
}

void CCMonthCalCtrl_s1Dlg::OnSetviewSetcenturyview()
{
    m_monthCalCtrl.SetCenturyView();
}

See Also

Reference

CMonthCalCtrl Class

Hierarchy Chart

MCM_SETCURRENTVIEW

CMonthCalCtrl::SetCurrentView

Other Resources

CMonthCalCtrl Members