Share via


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

請參閱

參考

CDateTimeCtrl 類別

階層架構圖表