CDateTimeCtrl::SetFormat
设置日期和时间选择器控件的显示与特定格式字符串匹配。
BOOL SetFormat(
LPCTSTR pstrFormat
);
参数
- pstrFormat
用于定义预期显示的以零结尾的格式字符串的指针。 设置为 NULL 的此参数将重置为当前样式的默认格式字符串。
返回值
非零,如果成功;否则为0。
备注
用户输入不确定成功或此调用失败。
备注
此成员函数实现Win32消息 DTM_SETFORMAT的行为,如 Windows SDK所述。
示例
// The control will create itself with a format that matches the
// locale setting in Control Panel. But we can force a particular
// format with a call to SetFormat(). This call forces the format
// dd-MMM-yy, which would show 03-APR-98 for April 3rd, 1998.
m_DateTimeCtrl.SetFormat(_T("dd-MMM-yy"));
要求
Header: afxdtctl.h