Monday, October 20, 2008

Standard System Fonts

I have been looking into system fonts and "Windows Form Applications" in Visual Studio. You can change your OS system fonts on XP via the “Display” property dialog. In the Display” property dialog, under the “Appearance” tab, there is an “Advanced” button that will allow you to configure the system font. Furthermore, .Net has the System.Drawing.SystemFonts object that can be used to access system fonts.

clip_image002

The following table maps the fonts that can be configured via the “Advanced Appearance” dialog to the fonts that are available from System.Drawing.SystemFonts.

 

Advanced Appearance Dialog System.Drawing.SystemFonts
n/a System.Drawing.SystemFonts.DefaultFont
n/a

System.Drawing.SystemFonts.DialogFont

Active Title Bar

System.Drawing.SystemFonts.CaptionFont

Icon

System.Drawing.SystemFonts.IconTitleFont

Inactive Title Bar

System.Drawing.SystemFonts.CaptionFont

Menu

System.Drawing.SystemFonts.MenuFont

Message Box

System.Drawing.SystemFonts.MessageBoxFont

Palette Title

System.Drawing.SystemFonts.SmallCaptionFont

Selected Items

System.Drawing.SystemFonts.MenuFont

ToolTip

System.Drawing.SystemFonts.StatusFont

Important fonts in System.Drawing.SystemFonts

  1. System.Drawing.SystemFonts.DefaultFont is the default font of the operating system and it is defined in the registry at “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes\MS Shell Dlg”. It is defaulted to “Microsoft Sans Serif” and is the font that Visual Studio seems to use for Windows Form applications.
  2. System.Drawing.SystemFonts.DialogFont is defined by .Net and, as far as I can tell, it is hard coded to “Tahoma 8 pt” font for Windows 2000 and higher, otherwise the System.Drawing.SystemFonts.DefaultFont is used.
  3. System.Drawing.SystemFonts.MessageBoxFont is the default for message boxes and is also the default font for WPF Applications in Visual Studio. System.Drawing.SystemFonts.MessageBoxFont defaults to “Tahoma” on Windows XP and “Segoe UI” on Vista.

Conclusion

The default font provided is not good enough for today's professional looking applications. System.Drawing.SystemFonts.DialogFont seems to be a good choice, but doesn’t change on Vista. I believe System.Drawing.SystemFonts.MessageBoxFont should be the primary font used in Windows Form Application development.