Archived

This topic is now archived and is closed to further replies.

civguy

Changing a font in Windows dialog

Recommended Posts

Here''s what I''m doing
  
	CFont fntMy;
	fntMy.CreateFont(0,0,0,0,FW_NORMAL,0,0,0,DEFAULT_CHARSET,
										OUT_CHARACTER_PRECIS,CLIP_CHARACTER_PRECIS,DEFAULT_QUALITY,
										DEFAULT_PITCH | FF_DONTCARE, "Courier");
	m_cResult.SetFont(&fntMy);
  
Where m_cResult is the control to the edit box I want to change. This doesn''t work properly - it changes the font to something, but not to "Courier". And the font also bugs when I try to type with it. Do I have to enumerate the fonts to get the correct font name, or is there an easier way? All I need is Courier and I know everyone has that font. (the reason I need it is because it has fixed width. If you have any other idea on how to get fixed width for an edit box, I could use it as well )

Share this post


Link to post
Share on other sites
  

LOGFONT logfont;

GetObject (GetStockObject (SYSTEM_FIXED_FONT), sizeof (LOGFONT), (PTSTR) &logfont);

HFONT hFont = CreateFontIndirect (&logfont);

if(hFont == NULL)
return false;

m_cResult.SetFont(hFont);





Zeblar Nagrim, Lord of Chaos

Share this post


Link to post
Share on other sites