Pixels to Point

Y

Yong

Hi,

I'm trying to convert Pixels to Point. Is there a formula or simple API
call? I was using Word witch has an Application.PixelsToPoints. But it
takes a bit of time to start Word up so I'm trying to avoid using Word. I do
have PowerPoint application open availalbe to me but it doesn't have
PixelsToPoints function.

thanks in advance
 
K

Karl E. Peterson

Yong said:
I'm trying to convert Pixels to Point. Is there a formula or simple
API call? I was using Word witch has an Application.PixelsToPoints.
But it takes a bit of time to start Word up so I'm trying to avoid
using Word. I do have PowerPoint application open availalbe to me
but it doesn't have PixelsToPoints function.

I'm not sure if this (taken from http://vb.mvps.org/samples/NCMetrics) is what you're
looking for, but it might be?

Private Function PixelsPerInchY() As Long
Dim hWnd As Long
Dim hDC As Long
' Retrieves the number of pixels per logical
' inch in the Y-direction on screen.
hWnd = GetDesktopWindow()
hDC = GetDC(hWnd)
PixelsPerInchY = GetDeviceCaps(hDC, LOGPIXELSY)
Call ReleaseDC(hWnd, hDC)
End Function

Of course, there are 72 points per inch, so knowing that and the above, you ought to
be able to convert between points and pixels, huh?
 

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

Top