I am making dialog based programs with MFC. How do I change the text of the edit control to bold or change the size? Where and what kind of code should I write? Please tell me specifically.
Asked
Active
Viewed 1,558 times
1 Answers
3
In your OnInitDialog
, create a CFont
object (declared in your dialog)
m_pFont=new CFont;
int lfHeight;
lfHeight = (int) -(dSize* 90 / 72.);
int nWeight=FW_NORMAL;
if ( isBold )
nWeight=FW_BOLD;
pFont->CreateFont( lfHeight , 0, 0, 0, nWeight, (BYTE)isItalic, (BYTE)isUnderline, 0, (BYTE)nCharSet, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH, _T("Arial") );
And then call SetFont(m_pFont)
for your edit control - delete it in your destructor.

Andrew Truckle
- 17,769
- 16
- 66
- 164

BadJerry
- 154
- 1
- 12