VB Migration Partner

KNOWLEDGE BASE - Language


Previous | Index | Next 

[PRB] Output from the Print statement appears slightly different from the original VB6 application

The CodeArchitects.VBLibrary contains a replacement for the Print method exposed by the Form, UserControl, PictureBox, and Printer classes. These methods are implemented in quite different ways.

The Printer.Print method is forwarded to the VBSupportLib.dll – a VB6 DLL that provides printing support to migrated VB.NET - therefore the print output is virtually indistinguishable from the original VB6 output. Conversely, the Print method exposed by the Form, UserControl, and PictureBox classes is simulated and invokes the System.Drawning.Graphics.DrawString method behind the scenes.

For most practical purposes, the VB.NET output mimics the original VB6 closely enough to be usable in real-world applications. However, keep in mind that there are just too many factors that can affect the result and make it differ from the expected one. For example, Windows Forms applications don’t support Windows standard fonts, thus the VB Migration Partner converts them to Arial by default. (You can change this default choice by means of the ReplaceFormFont pragma.) Also, the TextWidth and TextHeight methods in the control support library may return values that slightly differ from their VB6 counterparts.

Finally, we have noticed that the Graphics.DrawString method – that is ultimately used to display the text - tends to offset the output string by a few pixels to the right. If perfect alignment is important, you might need to manually adjust the value of the CurrentX property before emitting the string, for example by means of an InsertStatement pragma:

    Picture1.Cls
    '##InsertStatement Picture1.CurrentX = -120
    Picture1.Print "Test string"
Previous | Index | Next 




Follow Francesco Balena on VB6 migration’s group on

LinkedIn





Read Microsoft Corp’s official case study of a VB6 conversion using VB Migration Partner.




Code Architects and its partners offers remote and onsite migration services.

More details




Subscribe to our free newsletter for useful VB6 migration tips and techniques.

newsletter



To learn more about your VB6 applications, run VB6 Analyzer on your source code and send us the generated text file. You will receive a detailed report about your VB6 applications and how VB Migration Partner can help you to quickly and effectively migrate it to .NET.

Get free advice



A fully-working, time-limited Trial Edition of VB Migration Partner allows you to test it against your actual code

Get the Trial




The price of VB Migration Partner depends on the size of the VB6 application, the type of license, and other factors

Request a quote




Migrating a VB6 application in 10 easy steps

Comparing VB Migration Partner with Upgrade Wizard

Migration tools: Feature Comparison Table

All whitepapers