Udostępnij za pośrednictwem


CDateTimeCtrl::SetMonthCalStyle

Sets the style of the drop-down month calendar control that is associated with the current date and time picker control.

DWORD SetMonthCalStyle(
      DWORD dwStyle
);

Parameters

Parameter

Description

[in] dwStyle

A new month calendar control style, which is a bitwise combination (OR) of month calendar control styles. For more information, see Month Calendar Control Styles.

Return Value

The previous style of the drop-down month calendar control.

Remarks

This method sends the DTM_SETMCSTYLE message, which is described in the Windows SDK.

Example

The following code example defines the variable, m_dateTimeCtrl, that is used to programmatically access the date and time picker control. This variable is used in the next example.

    // Variable to access date-time control.
    CDateTimeCtrl m_dateTimeCtrl;
    // Variable to access the splitbutton control
    CSplitButton m_splitbutton;

The following code example sets the date and time picker control to display week numbers, abbreviated names of days of the week, and no today indicator.

// Set the style of the month-calendar control dropdown.
void CCDateTimeCtrl_s1Dlg::OnSetmonthcalstyleWeeknumber()
{
    m_dateTimeCtrl.SetMonthCalStyle( MCS_WEEKNUMBERS );
}

void CCDateTimeCtrl_s1Dlg::OnSetmonthcalstyleNotoday()
{
    m_dateTimeCtrl.SetMonthCalStyle( MCS_NOTODAY );
}

void CCDateTimeCtrl_s1Dlg::OnSetmonthcalstyleShortdaysofweek()
{
    m_dateTimeCtrl.SetMonthCalStyle( MCS_SHORTDAYSOFWEEK  );
}

Requirements

Header: afxdtctl.h

This method is supported in Windows Vista and later.

See Also

Reference

CDateTimeCtrl Class

Hierarchy Chart

CDateTimeCtrl::GetMonthCalStyle

DTM_SETMCSTYLE

Date and Time Picker Control Styles

Other Resources

CDateTimeCtrl Members