How to change the font of the CEditView?
Printable View
How to change the font of the CEditView?
You need to declare a CFont object and use the CreateFont function. The following example sets the font to 12 point Arial.
[ccode]
CFont fontText;
fontText.CreateFont(12, 0, 0, 0, 400, FALSE, FALSE, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, "Arial");
//You then have to point the device context to the new font.
CClientDC dc(this);
dc.SelectObject(&fontText);