Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fonts

Status
Not open for further replies.

Zyrenthian

Programmer
Mar 30, 2001
1,440
US
Hi All,
I was presented with an interesting question and I was curious if it was possible.

Over the years, our product has had many revisions and now has many dialog windows. It is at all possible to set the font in a single place and have it take effect everywhere (Including AfxMessageBox)? I thought "theApp" would have had a SetFont or CreateFont function but it does not. I assumed that this would be the place to start as well. Could I do it with a DC? API call?

Any help would be appreciated

Matt
 
I think, any window has its own colors, sizes, devicecaps, fonts etc., and all dialogs, property pages, views, menu items, lists ... are windows too. Some child windows can take default attributes from parents, but not all. You should set a default font by creation of each window (some work, isn't?) or You can try to hook/catch all showed/created windows and send WM_SETFONT message to them before tthey will be shown.
With AfxMessageBox it is the same: You can set default system font before You call it and reset after the call or You can send the message with a hook. But it is better, do not use AfxMessageBox directly. You should use Your own global Function to show all messages, and in this Function You can then call AfxMessageBox or Dialog or another things You wish. In this case, You will have not so much problems if You wish to rewrite Your program to another OS.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top