Jump to content
  • Advertisement

Archived

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

Changing a font in Windows dialog

This topic is 5984 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
  

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

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!