方法一:
CWnd* pEdit; pEdit = GetDlgItem(IDC_EDIT_ONE); ASSERT(pEdit != NULL); HFONT hFont = (HFONT)::GetStockObject(SYSTEM_FIXED_FONT); CFont* pFont = CFont::FromHandle(hFont); pEdit->SetFont(pFont);
方法二:
CFont * f; f = new CFont; f->CreateFont(22, // nHeight 0, // nWidth 0, // nEscapement 0, // nOrientation FW_BOLD, // nWeight TRUE, // bItalic FALSE, // bUnderline 0, // cStrikeOut ANSI_CHARSET, // nCharSet OUT_DEFAULT_PRECIS, // nOutPrecision CLIP_DEFAULT_PRECIS, // nClipPrecision DEFAULT_QUALITY, // nQuality DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily _T("Arial")); // lpszFac GetDlgItem(IDC_EDIT_RECEIVE)->SetFont(f); //IDC_EDIT_RECEIVE是Edit框標號