Convert Unit types.

Discussion in 'ASP .Net Web Controls' started by Ken Varn, Oct 19, 2004.

  1. Ken Varn

    Ken Varn Guest

    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
    -----------------------------------
    Ken Varn, Oct 19, 2004
    #1
    1. Advertising

  2. Ken Varn

    WALDO Guest

    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.

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    WALDO, Oct 26, 2004
    #2
    1. Advertising

  3. Ken Varn

    WALDO Guest

    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.

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    WALDO, Oct 26, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. VvanN
    Replies:
    5
    Views:
    476
    Phlip
    Apr 28, 2006
  2. Bill David
    Replies:
    2
    Views:
    261
    Arne Vajhøj
    Jun 18, 2008
  3. Ulrich Eckhardt

    unit-profiling, similar to unit-testing

    Ulrich Eckhardt, Nov 16, 2011, in forum: Python
    Replies:
    6
    Views:
    318
    Roy Smith
    Nov 18, 2011
  4. Bill Mosteller
    Replies:
    0
    Views:
    209
    Bill Mosteller
    Oct 22, 2009
  5. timr
    Replies:
    2
    Views:
    152
Loading...

Share This Page