How can I change font in EditBox?
Thanx.
Printable View
How can I change font in EditBox?
Thanx.
In OnInitDialog try use this:
CWindowDC dcText(&m_MyEdit);
CFont* pFont=dcText.GetCurrentFont( );
LOGFONT lf;
pFont->GetLogFont(&lf);
// For instance:
lf.lfUnderline =TRUE;//Change font to be underlined
m_Font.CreateFontIndirect (&lf)
m_MyEdit.SetFont(&m_Font);
where m_Font declared as CFont , m_MyEdit declared as CEdit in your CDialog derived.
At run-time you can get a pointer to CEdit using GetDlgItem:
CEdit *pEdit=(CEdit *)GetDlgItem(ID_EDIT1);
Hope this helps,
Oleg.
Thanx, your hopes comes true, and i found another way.
LOGFONT lf;
GetDlgItem(IDC_OUTPUT)->GetFont()->GetLogFont(&lf);
strcpy(lf.lfFaceName, "Fixedsys");
fnt.CreateFontIndirect(&lf);
GetDlgItem(IDC_OUTPUT)->SetFont(&fnt);