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.

Monday, September 01, 2008

Microsoft Certified Technology Specialist

I passed a second Microsoft certification exam. Now I'm a Microsoft Certified Technology Specialist.

Friday, August 08, 2008

Office 2007 and Fitts' Law

Whether you think Office 2007 is brilliant or if you're wondering what was Microsoft thinking, Jensen Harris’ blog has some fascinating insight into UI design. He explains Fitts’ law and how it was used in the creation of Office 2007.

Think about Word 1.0, which was designed for a common maximum 640x480 screen resolution. Toolbar buttons in Word 1.0 were 20x20 buttons with 16x16 icons in them.

Word 2003, on the other hand, is commonly run at resolutions as high as 1600x1200 and beyond--yet the toolbar buttons remain the same 20x20 size they were in Word 1.0. But because the screen is so much larger, most of the time your mouse cursor will be much farther away than it could have been on a 640x480 screen. Greater mouse distances mean an increased MT target acquisition time.

In other words, the same button takes much longer to click than it did fifteen years ago.

Tuesday, August 05, 2008

Win32 vs. WPF Performance

I created two similar applications in Visual Studio 2008, one as a Windows Forms Application and the other as a WPF Application.

Windows Forms Application (Win32) WPF Application

I then preformed the following tests (ran tests three times and recorded the average) as listed below:

  • Time it takes to open one window.
  • Time it takes to open 100 windows.
  • Time it takes to open a window with many controls.
  • Amount of memory consumed after opening the application.
  • Amount of memory consumed after launching one window.
  • Amount of memory consumed after launching 100 windows.
  • Amount of memory consumed after launching a window with many controls.
  • Amount of memory consumed after launching a Win32 open dialog (only in WPF).

Note: I only tested this on a single Windows XP machine and a single Vista machine. And I am ignoring hardware configurations.
Note: Memory was recorded from the task manager.

Windows XP – Time in seconds

 

Win32

WPF

Launch Single Window

0.0233669

0.2370075

Launch 100 Windows

1.0548501

21.5009168

Controls Window

0.3838853

0.4473099

Windows XP – Memory

 

Win32

WPF

Just Application

13,345K

19,340K

Launch Single Window

13,885K

20,867K

Launch 100 Windows

15,089K

55,685K

Controls Window

16,333K

24,859K

Launch Win32 Dialog

23,440K

Vista – Time in seconds

 

Win32

WPF

Launch Single Window

0.0170000

0.913333

Launch 100 Windows

1.1940000

12.43466667

Controls Window

0.2886667

0.4900000

Vista - Memory

 

Win32

WPF

Just Application

3,623K

11,995K

Launch Single Window

3,715K

12,595K

Launch 100 Windows

4,377K

15,715K

Controls Window

6,132K

16,241K

Launch Win32 Dialog

14,132K

Results

Windows XP

  • Unless you have a lot of controls on a window, Win32 is faster. In my test of the control window Win32 was faster, however WPF was not far behind.
  • WPF can manage a lot of controls on a form better then Win32. It is hard to show in a benchmark, but by running the applications you will notice that sizing the controls window in WFP is more responsive then Win32.
  • Launch many WPF windows is slow and consumes a lot of memory.
  • When you launch a Win32 dialog from WPF there is overhead.
  • In general WPF comes at a cost in memory and performance.

Vista

  • For the most part the story is the same. WPF comes at a cost in memory and performance.
  • It seems that WPF doesn’t consume as much memory in the 100 windows test (at least on Vista machine that I tested).
  • On my Vista machine there was a noticeable difference in appearance between WPF windows and Win32 windows. The Win32 windows looked blurry and not as clean and crisp as the WPF windows. This alone may make WPF worth it. Sure it is slower and takes up more memory but it does look nicer.
Vista Images

Click the images to see them at full size.

 Win32ControlDlg

WPFControlsDlg

Sunday, April 06, 2008

How To Make A Wi-Fi Extender

This reminds me that there are still simple solutions to high tech problems.



youTube Link