Convert Unit types.

K

Ken Varn

Can someone explain how to convert a Unit type to a meaningful value? There
is a way to convert from a Pixel, Percent, etc.. to a Unit, but I have not
figured out how to convert from a Unit.

--
-----------------------------------
Ken Varn
Senior Software Engineer
Diebold Inc.

EmailID = varnk
Domain = Diebold.com
-----------------------------------
 
W

WALDO

The Unit structure is merely there to convert those unit types into
strings for web controls. There is no math involved in this structure.

If you want to do conversions, you'll have to write your own conversion
functions.

Off the top of my head, I think it's:
72 points/inch (I could be wrong)
96 pixels/inch (I could be wrong)
You can convert percent to pixels and vice-versa if you know the width
in pixels of whatever its contained in. (10% of a 400px container is
40px)



Sometimes the greatest solutions come from the simplest logic.
Being told no is merely the incentive to do it anyway.
 
W

WALDO

There are also the Type and Value Properties on the Unit Structure. For
Example:

Dim u As Unit = Unit.Parse("17px")
'u.Value = 17
'u.Type = Pixel



Sometimes the greatest solutions come from the simplest logic.
Being told no is merely the incentive to do it anyway.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top