CDateTimeCtrl::SetMonthCalFont

更新 : 2007 年 11 月

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

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

パラメータ

  • hFont
    設定するフォントへのハンドル。

  • bRedraw
    フォントの設定直後にコントロールを再描画するかどうか。このパラメータを TRUE に設定すると、コントロールは自動的に再描画されます。

解説

このメンバ関数は、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);
}
y7x5938a.alert_note(ja-jp,VS.90).gifメモ :

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

必要条件

ヘッダー : afxdtctl.h

参照

参照

CDateTimeCtrl クラス

階層図

CDateTimeCtrl::GetMonthCalFont

その他の技術情報

CDateTimeCtrl のメンバ