In the VB world previous to .NET a concept you probably had to deal with was
TWIPS.
What were Twips? Well if you do not remember those happy VB6 times, let me
refresh your memory:
Twips are screen-independent units to ensure that the proportion of screen
elements are the same on all display systems.
A twip is defined as being 1/1440 of an inch.
A Pixel is a screen-dependent unit, standing for 'picture element'.
A pixel is a dot that represents the smallest graphical measurement on a screen.
In .NET everything is pixels. So if you migrated something from VB6 using the
Upgrade Wizard you might found several expressions like:
VB6.TwipsToPixelsX(ctrl.Left)
or VB6.PixelsToTwipsY(ctrl.Height)
There is an X and a Y version of this function, because the conversion factor
is not the same for both axis.
Sadly you can even found some expressions like:
VB6.TwipsToPixelsX(VB6.PixelsToTwipsX(ctrl.Left))
In a strict sense there could be minor differences because of the conversion
factors. But in it seams that things like that can be removed because all
controls Bound properties like Left, Top, Bottom, Right are in pixels. So why
will you convert your pixels units to Twips units to then convert them back to
Pixels if they where already in Pixels????
Also you can find something like:
VB6.TwipsToPixelsX(ctrl.Left + ctrl.Width + 30)
which should be something
like:
ctrl.Left + ctrl.Width + VB6.TwipsToPixelsX(30)
If you have an application migrated with the Upgrade Wizard you can use some
regular expressions to improve those expressions. If the conversion is something
like:
VB6.TwipsToPixelsY(VB6.PixelsToTwipsX(ctrl.Left))
then be careful because
conversion factor might produce a different value, due to the change of axis.
jeje Or you can uset the VBCompanion, the extensible version of the Upgrade
Wizard!!!