void SetMonthCalFont( HFONT hFont, BOOL bRedraw = TRUE );
Parameters
hFont
Handle to the font that will be set.
bRedraw
Specifies whether the control should be redrawn immediately upon setting the font. Setting this parameter to TRUE causes the control to redraw itself.
Remarks
This member function implements the behavior of the Win32 message DTM_SETMCFONT, as described in the Platform SDK.
Example
// The following code example creates a font
// (Arial, 10 pixels high) and if successful,
// stores the result in m_pMonthFont. SetMonthCalFont
// is then called passing in the new font, causing
// the month calendar control to display all
// text and dates with an Arial font.
BOOL CYourDialog::OnInitDialog()
{
CDialog::OnInitDialog();
// ... other code here ...
//initializing the necessary members of the LOGFONT
// structure
m_pMonthFont = new CFont;
LOGFONT lf; memset(&lf, 0, sizeof(lf));
lf.lfHeight = 10;
strcpy(lf.lfFaceName, "Arial");
if (m_pMonthFont->CreateFontIndirect(&lf))
{
// if successful, grab the month calendar control from
// our dialog and set the font
CMonthCalCtrl* pCtrl = (CMonthCalCtrl*) GetDlgItem(IDC_DATETIME1);
ASSERT(pCtrl != NULL);
pCtrl->SetMonthCalFont(m_pMonthFont);
}
else
{
// if not successful, clean up the font pointer and
// set equal to NULL
delete m_pMonthFont;
m_pMonthFont = NULL;
}
// ... other code here ...
}
CYourDialog::CYourDialog(CWnd* pParent /*=NULL*/)
: CDialog(CYourDialog::IDD, pParent)
{
// ... other code here ...
m_pMonthFont = NULL;
// ... other code here ...
}
CYourDialog::~CYourDialog()
{
// ... other code here ...
delete m_pMonthFont;
// ... other code here ...
}
Note If you use this code, you'll want to make a member of your CDialog-derived class called m_pMonthFont
of type CFont*.
CDateTimeCtrl Overview | Class Members | Hierarchy Chart
See Also CDateTimeCtrl::GetMonthCalFont