Jump to content
  • Advertisement
Sign in to follow this  
wforl

win32 edit box, fixed pitch font

This topic is 3741 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

How do i set up a fixed pitch font for an edit box? im using somthing like SendMessage(GetDlgItem(hwnd,IDC_EDIT_LOADED_OBJECTS_INFO), WM_SETFONT,(WPARAM)CreateFont (0, 0, 0, 0, 0, 0, 0, 0,ANSI_CHARSET, 0, 0, CLEARTYPE_QUALITY, FIXED_PITCH, NULL), 0); atm, which works, but even with messing with the values, im still not getting the font i would like, basically i just want the font thats used normally, but with a fixed pitch, is this possible?

Share this post


Link to post
Share on other sites
Advertisement
Let me see if I understand what you're asking. Do you want to take an edit box that is currently using a non-fixed width font like Arial, and then make it use Arial letters, but with a fixed width for each letter?

Share this post


Link to post
Share on other sites
You can use GetStockObject to get the few common things, such as the standard fixed-pitch font.

But it sounds like you want the DEFAULT_GUI_FONT, but with fixed pitch. I looked around on MSDN, and GetObject sounds like it might help.

So something like this might work:

LOGFONT lf;
GetObject(GetStockObject(DEFAULT_GUI_FONT), sizeof(LOGFONT), &lf);
lf.lfPitchAndFamily = (lf.lfPitchAndFamily & ~3) | FIXED_PITCH;
HFONT hFont = CreateFontIndirect(&lf);
SendMessage(GetDlgItem(hwnd, IDC_EDIT_LOADED_OBJECTS_INFO), WM_SETFONT, (WPARAM)hFont, 0);

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!