Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TwipsPerPixel in Access

Status
Not open for further replies.

freewilly

Programmer
Feb 19, 2001
43
0
0
AU
Hi Team

Does anyone know how to get the VB equivilent of Screen.TwipsPerPixel in Access?

I'm want to be able to edit the values in a ListView by double clicking it. I need TwipsPerPixel to know where I clicked.

Thanks

FW
 
Microsoft Knowledge Base Article - 210590 gives you the function you need:


Option Explicit

Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, _
ByVal hdc As Long) As Long
Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, _
ByVal nIndex As Long) As Long

Const WU_LOGPIXELSX = 88
Const WU_LOGPIXELSY = 90

Function ConvertTwipsToPixels (lngTwips as Long, _
lngDirection as long) As Long

'Handle to device
Dim lngDC as long
Dim lngPixelsPerInch as Long
Const nTwipsPerInch = 1440
lngDC = GetDC(0)

If (lngDirection = 0) Then 'Horizontal
lngPixelsPerInch = GetDeviceCaps(lngDC, WU_LOGPIXELSX)
Else 'Vertical
lngPixelsPerInch = GetDeviceCaps(lngDC, WU_LOGPIXELSY)
End If
lngDC = ReleaseDC(0, lngDC)
ConvertTwipsToPixels = (lngTwips / nTwipsPerInch) * lngPixelsPerInch

End Function


hth

Ben

----------------------------------------------
Ben O'Hara

"Where are all the stupid people from...
...And how'd they get so dumb?"
NoFX-The Decline
----------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top