- INDEX VB TO NET
- KNOWLEDGE BASE
- EWIS-ISSUES
- ISSUE #2038
ISSUE #2038
Form property 1%.ScaleMode is not supported.
Description
In VB6 you could use a scale mode different to pixels to use as the unit for measures and locations in a form. This is not longer supported by .Net.
Recommendations
Use these functions, to convert units to pixels, depending of the scale mode. Unit can be centimeters, millimeters, inches, etc.
- Microsoft.VisualBasic.Compatibility.VB6.Support.ToPixelsX(value, VB6.ScaleMode.Unit)
- Microsoft.VisualBasic.Compatibility.VB6.Support.ToPixelsY(value, VB6.ScaleMode.Unit)
- Microsoft.VisualBasic.Compatibility.VB6.Support.TwipsToPixelsX(value)
- Microsoft.VisualBasic.Compatibility.VB6.Support.TwipsToPixelsY(value)
Sample VB6
PublicSub SetScaleMode()
Me.ScaleMode = 1 'Twips
Me.Width = 10000
EndSub
Target VB.NET
PublicSub SetScaleMode()
'UPGRADE_ISSUE: (2038) Form property ewi2038.ScaleMode is not supported.
ScaleMode = 1
Width = Microsoft.VisualBasic.Compatibility.VB6.Support.TwipsToPixelsX(100)
EndSub
Target C#
publicvoid SetScaleMode()
{
//UPGRADE_ISSUE: (2038) Form property ewi2038.ScaleMode is not supported.
this.ScaleMode = 1; //Twips
this.Width = (int) VB6.TwipsToPixelsX(10000);
}