日時指定コントロールの月間予定表子コントロールで使用するフォントを設定します。
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);
}
注意
このコードを使用する場合は、CDialog 派生クラスのメンバー m_MonthFont を CFont 型にする必要があります。
必要条件
**ヘッダー:**afxdtctl.h
参照
参照
CDateTimeCtrl::GetMonthCalFont