CDateTimeCtrl::SetMonthCalFont

日時指定コントロールの子月間予定表コントロールが使用するフォントを設定します。

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

パラメーター

  • hFont
    設定されているフォントのハンドル。

  • bRedraw
    コントロールにフォントを設定した上で直ちに再描画するかどうかを指定します。[真] にこのパラメーターを設定すると、コントロール自体を再描画します。

解説

このメンバー関数は Windows SDKに記述されている Win32 メッセージの動作を DTM_SETMCFONT実行します。

使用例

// 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);
}

[!メモ]

このコードを使用する場合は、- CFont型の派生クラスでを呼び出した m_MonthFont、の CDialogのメンバーする必要があります。

必要条件

Header: afxdtctl.h

参照

関連項目

CDateTimeCtrl クラス

階層図

CDateTimeCtrl::GetMonthCalFont