VB6 - FontWiz: The Missing Piece in Styling Your Programs
By now nearly everyone is aware of the basic technique for slapping the User Interface Themes of Windows XP and Vista onto VB6 programs. You create an application manifest that requests version 6.0 of the Common Controls, you call InitCommonControlsEx() before loading your first Form, you put OptionButton and CheckBox controls into PictureBox controls instead of Frames, you use Microsoft Common Controls 5.0 (COMCTL32.OCX) instead of Microsoft Common Controls 6.0 (MSCOMCTL.OCX).
Old news indeed. But it does auto-adapt to changing theming from OS to OS and machine to machine for the most part.
But what about your fonts? Still using cruddy old MS Sans Serif, or do you laboriously change the Font property of every control in your Projects by hand?
Adding the FontWiz class to a VB6 project produces a predeclared global object named FontWiz to your program. You can call methods on this object at runtime to adapt the font used in Form and UserControl controls to the system-standard User Interface font. This can be used as a second step in modernizing your VB6 program's UI, after taking the steps necessary to invoke the Common Controls 6.0 themeing. It is often neglected, leaving your programs still looking crude and a bit "off."
In early versions of Windows the standard UI font is 8pt MS Sans Serif, and VB6 is hard-coded to enforce this unless you override the default manually or through new IDE module templates. Beginning with Windows 2000 the default was changed to 8pt Tahoma for a cleaner and more legible look. Starting with Vista the system default is now 9pt Segoe UI to further improve clarity, especially for non-English language characters.
But "dumb old Vb6" was never updated to accomodate the changes. Thus FontWiz was born.
To use FontWiz you just add FontWiz.cls to your Project and then add the appropriate method calls to your Project's Forms and UserControls. More complete information is available in a block of comments at the head of FontWiz.cls itself.
The attached archive contains a sample Project called FontWizDemo that does little more than show how to use the FontWiz object.
Just to flesh out the comparisons I included a screenshot showing how the program looks with the default VB6 font. Bleh.
Last edited by dilettante; Sep 3rd, 2014 at 01:38 PM.