Friday, December 29, 2006
Windows XP dialog default font changed automatically!
Recently, we had a customer running chinese on his machine have a problem with the way in which fonts were being choosen for the dialog.
On all our machines the dialog would default to MS Sans Serif. But on this one machine it would switch to a serif based font.
We tried changing fonts via the Appearance dialog under Display Properties, but that would not do it. We even tried changing the DPI to recreate the issue, tried installing foreign language packs, but we just could not recreate the proble.
Then we found the following registry item : "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes"
Under that key are two entries MS Shell Dlg and MS Shell Dlg 2. These are set to Microsoft Sans Serif and Tahoma respectively on my machine. If you change these, then, VOILA!, the font used in the dialog started to change.
More info about this key is available at http://support.microsoft.com/kb/282187
Once we had a way to recreate the problem, we were able to provide a fix to the customer, as well as fix the code so that it would better scaled dialogs to handle different fonts.
Lesson here: never resize dialogs by hard-coded values. Either use the automatic scaling functionality provided by .NET 2.0, or resize to a location that is offset from a control on the dialog. That way, when fonts change and the position of the controls change, your dialog will resize to the new location without a problem.
This probably is my last post for 2006 - So HAPPY NEW YEAR!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment