nate
nate

Reputation: 1428

VB.NET Name 'vbPixels' is not declared and Name 'vbTwips' is not declared

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?

Upvotes: 1

Views: 1722

Answers (2)

Hans Passant
Hans Passant

Reputation: 941455

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

Upvotes: 2

jessehouwing
jessehouwing

Reputation: 114641

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)

Upvotes: 0

Related Questions