共用方式為


CDateTimeCtrl::SetMonthCalFont

設定日期時間選擇器控制項子月曆控制項上的字型。

void SetMonthCalFont( 
   HFONT hFont, 
   BOOL bRedraw = TRUE  
);

參數

  • hFont
    要設定的字型的控制代碼。

  • bRedraw
    指定是否應該重新繪製控制項緊接在設定字型。 設定為 的這個參數會重繪本身。

備註

此成員函式實作 Win32 訊息 DTM_SETMCFONT的行為 Windows SDK,如中所述。

範例

// The following code example would most likely appear 
// in the OnInitDialog function of your dialog class.   
// It creates a font (Arial, 10 pixels high) and if successful, 
// stores the result in m_MonthFont, a member of your 
// dialog class declared as follows: 
//    CFont m_MonthFont; 
// SetMonthCalFont is then called passing in the new font,  
// causing the month calendar control to display all 
// text and dates with an Arial font. 

//initializing the necessary members of the LOGFONT 
// structure

LOGFONT lf;
memset(&lf, 0, sizeof(lf));
lf.lfHeight = 10;
_tcscpy_s(lf.lfFaceName, LF_FACESIZE, _T("Arial"));

if (m_MonthFont.CreateFontIndirect(&lf))
{
   // if successful, set the month calendar font
   m_DateTimeCtrl.SetMonthCalFont((HFONT)m_MonthFont);
}
注意事項注意事項

如果您使用這段程式碼,您會想要只能夠您的 CDialog衍生類別型別 CFont呼叫的 m_MonthFont 。

需求

Header: afxdtctl.h

請參閱

參考

CDateTimeCtrl 類別

階層架構圖表

CDateTimeCtrl::GetMonthCalFont