we have recently upgraded an old VB6 windows app to C# .NET 4.0. I am looking to replace references to the Microsoft.VisualBasic.Compatibility.VB6.Support class, as Visual Basic 2010 is warning me that ‘Microsoft.VisualBasic.Compatibility.* classes are obsolete and supported within 32 bit processes only. http://go.microsoft.com/fwlink/?linkid=160862‘
This article assures me that: ‘Functions in the Compatibility namespaces were created to work around shortcomings in version 1.0 of the .NET Framework. In most cases, functionality added in later framework versions can be used to rewrite the functions, resulting in improved performance.’
My question is, what are the additions to later framework versions that I need to use to do away with the Compatibility.* classes? I need to phase out TwipsToPixelX, TwipsToPixelY, and so forth. Also, FontChangeUnderline, FontChangeSize, and other font-related stuff.
The font related functions can be replaced easily enough. For example:
This checks whether the desired style is already set. If it is, it returns the old font. Otherwise it will return a new font that has the same style, except for the
boldstyle, which is now set according to the requirement.