Domanda

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?

È stato utile?

Soluzione

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

Altri suggerimenti

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)
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top