You will want to do the following before the static text control is shown on the parent window.
- Get a handle to the window:
CWnd * pwnd = GetDlgItem(IDC_LABEL); - Get the current font for the static text:
CFont * pfont = pwnd->GetFont(); - Get the characteristics of the font:
LOGFONT lf; pfont->GetLogFont(&lf); - Change the lfWeight and lfItalic fields in
lf. - Put a CFont object in your parent window, so it will exist for the entire lifetime of the child window.
- Initialize the CFont:
m_font.CreateFontIndirect(&lf); - Set the font into the static text window:
pwnd->SetFont(&m_font);
Mark Ransom
2010-04-13 18:15:50