Reputation: 11
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.
Upvotes: 0
Views: 2067
Reputation: 156
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.
Upvotes: 4