Font Disparities
In Visual Basic 6, it is possible to use two different types of fonts: raster and TrueType. Although TrueType fonts will upgrade to Visual Basic .NET, raster fonts are no longer supported. This change can present a problem for your application. What happens to your carefully laid-out forms? Table 10-1 shows how the Upgrade Wizard translates various Visual Basic 6 fonts during the upgrade process.
Font Name | Type | Converted Font | Style Preserved? |
Arial | TrueType | Arial | Yes |
Comic Sans MS | TrueType | Comic Sans MS | Yes |
Courier | Raster | Microsoft Sans Serif | No: 8pt Plain |
Courier New | TrueType | Courier New | Yes |
FixedSys | Raster | Microsoft Sans Serif | No: 8pt Plain |
Microsoft Sans Serif | TrueType | Microsoft Sans Serif | Yes |
Modern | Raster | Microsoft Sans Serif | No: 8pt Plain |
MS Sans Serif | Raster | Microsoft Sans Serif | Yes |
MS Serif | Raster | Microsoft Sans Serif | Yes |
Roman | Raster | Microsoft Sans Serif | No: 8pt Plain |
Script | Raster | Microsoft Sans Serif | No: 8pt Plain |
Small Fonts | Raster | Microsoft Sans Serif | No: 8pt Plain |
System | Raster | Microsoft Sans Serif | No: 8pt Plain |
Terminal | Raster | Microsoft Sans Serif | No: 8pt Plain |
If you used the default font MS Sans Serif in a Visual Basic 6 form, your formatting will be preserved in Visual Basic .NET but the font will be changed to the Microsoft Sans Serif TrueType font. You may encounter a problem with layout disparities owing to the slight differences between the two fonts. Controls that are laid out with very tight constraints on your forms might exhibit a wrapping effect.
Non-TrueType fonts will lose their formatting when upgraded. The best way to ensure that your application preserves its look is to modify your Visual Basic 6 application to use TrueType fonts, thus ensuring that your upgraded forms will require minimal control repositioning. Figures 10-1 and 10-2 demonstrate what happens when raster fonts are upgraded. Figure 10-1 shows a sample application (FontTest, included on the companion CD) prepared in Visual Basic 6. Notice how both raster and TrueType fonts are represented.
Figure 10-1
Raster and TrueType fonts in Visual Basic 6.
As Figure 10-2 shows, the fonts can change dramatically after the application is upgraded to Visual Basic .NET with the Upgrade Wizard. This example demonstrates some of the challenges you will face in your form layouts.
Figure 10-2
Raster and TrueType fonts after upgrading.
Notice that all the raster fonts, with the exception of MS Sans Serif, lost their formatting and ended up in plain 8-point Arial. As you can see, you have no choice but to fix your fonts manually. Stick with MS Sans Serif, and you should have few problems. (With luck, only spot fixes will be required.) The other choice is to use TrueType fonts, which will always maintain formatting, although they too may require some tweaking.