Frage

I have some code that I converted in from VB6 to .NET, I get the error Name 'vbPixels' is not declared and Name 'vbTwips' is not declared. This worked fine in VB6.

Here is the code:

.Width = o.ScaleX(x, vbPixels, vbTwips)

Is there a way in .NET to do the same thing that was done in VB6?

War es hilfreich?

Lösung

Not adding vbPixels and vbTwips to VB.NET was intentional. It forces you to deal with the fact that locations and sizes are no longer expressed in twips, only pixels. You must convert your code likewise.

Which ought to be simple here since ".Width" already uses pixels as a unit. Thus:

  .Width = x

Andere Tipps

Check out the VB Power Pack (Microsoft.VisualBasic.PowerPacks.Vs.dll), which contains these constants:

Imports Microsoft.VisualBasic.PowerPacks.Printing.Compatibility.VB6

.Width = o.ScaleX(x, ScaleModeConstants.vbPixels, ScaleModeConstants.vbTwips)
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top