# What unit of measurement is involved here?

vb.net 2003

I am using  x= IE.Document.documentElement.scrollTop

What unit of measurement does x represent and how do I convert that into something that equals pixels?

Example:
if I move the scrollbar down 1 pixel x = 2
if I move the scrollbar down 2 pixels x = 5
if I move the scrollbar down 3 pixels x = 7
if I move the scrollbar down 10 pixels x = 24

Thanks

###### Who is Participating?

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
The units are pixels.  You seem to be moving the scrollbar by two or three pixels at a time.
Commented:
HtmlElement.ScrollTop Property
The distance, in pixels, between the top edge of the element and the top edge of its content.

How can this happen? We can only guess. Possibly Explorer manages scrollbar state using float or double variables, and converts them to integer before setting actual scrollbar position.
Suppose that full  document range is 12.0, and one step is 1.2 - this is calculated by Explorer using some criterions. In this case, when user scrolls page, internal counter changes by the following way:
0  1.2  2.4  3.6  4.8   ...

Actual  scrollbar position in pixels is:

0   1     2     4     5   ...

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Author Commented:
ozo - I double checked. Only 1 pixel at a time.

AlexFM
I agree that seems to be the case.  To add to the problem when I change monitors x changes also.
Example on a 17 inch display a 100 pixel movement sets x to 229  on a 19 inch display a 100 pixel movement sets x to 293.  Both set at (1024x768)  Go figure, you would think there would be something useful here with IE.Document.documentElement.scrollTop. but I can't find it, yet.
Commented:
Many graphics programs work with images using their actual size in mm, inches etc. In .NET you can see Graphics.DpiX and Graphics.DpiY properties. IE doesn't use it but it uses unmanaged API which does the same. Now suppose you have some image whith known pixel size (for example, 1 pixel = 1 mm), and you want to draw it with it's actual size. This is the place for floating-point calculations and setting scroll range. The same may apply to fonts - let's say you want to draw text with 2 mm height on any monitor with any screen resolution.
Author Commented:
I gave the Graphics.DpiX a try and can't find any relief there either. Thanks for all you insight, I going to go to work on a work around - thanks again.
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Software

From novice to tech pro — start learning today.