Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C++ (http://www.programmingforums.org/forum15.html)
-   -   [WIN32 API] GUI widgets font size (http://www.programmingforums.org/showthread.php?t=13891)

Klarre Sep 1st, 2007 6:22 AM

[WIN32 API] GUI widgets font size
 
How do I set what font should be used in GUI controls created using the CreateWindow function?

http://www.klarre.se/data/fontsize.png

Thanks for your help!

/Klarre

Eoin Sep 1st, 2007 9:58 AM

Hi Klarre, this is not exactly an answer to your question, but if you want to use controls it's recommended to use them with a Dialog window. That way you'll not only get the correct fonts but also other things that Windows handles automatically such as being able to cycle through the controls by pressing tab.

Prm753 Sep 1st, 2007 2:14 PM

I've always used something like this to get my font un-nasty:

:

HWND hWnd = GetDlgItem( hWndButton, "BUTTON" );
HFONT hFont = GetStockObject( DEFAULT_GUI_FONT );
SendMessage( hWndButton, WM_SETFONT, (WPARAM)hFont, TRUE );


Is that what you were looking for?

Klarre Sep 3rd, 2007 2:08 PM

Thanks Prm753! Works great!

Eoin, I will check out the dialog window thing. Thanks for the tip!

/Klarre


All times are GMT -5. The time now is 3:06 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC