|
-
Jan 10th, 2003, 11:14 PM
#1
Thread Starter
Hyperactive Member
Defualt/standard font
How do you retrieve what windows is using as a default font for static boxes (fontname, fontsize, etc.)?
-
Jan 11th, 2003, 12:46 PM
#2
I think GetSystemMetrics and SystemParametersInfo should retrieve most of what you want.
If not then you can get the metrics from the stock object SYSTEM_FONT.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 13th, 2003, 07:47 PM
#3
Thread Starter
Hyperactive Member
Using GetStockObject I was able to get several fonts, however the following off of MSDN was NOT true (atleast in the case of this machine):
SYSTEM_FONT - System font. By default, the system uses the system font to draw menus, dialog box controls, and text.
Windows 95/98 and Windows NT: The system font is MS Sans Serif.
Windows 2000/XP: The system font is Tahoma
However, using DEFAULT_GUI_FONT as it recommends later in that same article, I was able to get something very close but not exactly equivelant to what's in my windows, both in font and in size; I'm not being anal or anything, I just want to make sure I get it correct so that there aren't any problems running the app on another machine. I don't think GetSystemMetrics or SystemParametersInfo will provide any of the information I am seeking, though I may be wrong.
Here's some of the code I've tried:
-----
hFont = CreateFont(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL);
SendMessage(hwndLabel, WM_SETFONT, (UINT) hFont, 0);
Although I thought this wouldn't do jack to change the font, it seems to change the font face to Tahoma (MS Sans Serif, Arial, or some true type font) instead of System, but the font size remains the same.
-----
hFont = GetStockObject(DEFAULT_GUI_FONT);
SendMessage(hwndLabel, WM_SETFONT, (UINT) hFont, 0);
Creates the font that's really close to what's used, but not right...
-
Jan 14th, 2003, 12:16 AM
#4
Then create a static control in the dialog editor and leave all settings as default. Then in code send it a WM_GETFONT message.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|