Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Twips to Pixels
Message
From
11/12/2000 11:55:59
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00451602
Message ID:
00451648
Views:
21
>More information. I am using an ocx control and when I drop something on that control the ocx.DragDrop Function fires. The documentation says (the x and y values will identify the coordinates of the drop on the control. Note that these coordinates are in Twips and need to be converted (using Screen.TwipsPerPixelsX and Screen.TwipsPerPixelY) to pixels for use. ) The screen. calls are for VB.
>
>
>Thanks Again
>Kirk

Kirk,
One twip is 1/20 point, and 1440 twips = 1 inch.
FUNCTION _GetPixelsPerInch
LPARAMETERS lnDirection
DECLARE INTEGER ReleaseDC IN Win32Api;
	INTEGER nwnd, INTEGER hdc
DECLARE INTEGER GetDeviceCaps IN Win32API;
	INTEGER hdc, INTEGER nIndex
DECLARE INTEGER GetWindowDC IN Win32API;
	INTEGER hWnd

#DEFINE WU_LOGPIXELSX  88
#DEFINE WU_LOGPIXELSY 90
lnDC = GetWindowDC(0)
IF (lnDirection = 0)       &&Horizontal
	lnPixelsPerInch = GetDeviceCaps(lnDC, WU_LOGPIXELSX)
ELSE                       &&Vertical
	lnPixelsPerInch = GetDeviceCaps(lnDC, WU_LOGPIXELSY)
ENDIF
lnDC = ReleaseDC(0, lnDC)
RETURN lnPixelsPerInch
Sample treeview usage :
*form.init
thisform.nXmult = 1440/_GetPixelsPerInch(0)
thisform.nYmult = 1440/_GetPixelsPerInch(1)

*Oledragover
*** OLE Control Event ***
LPARAMETERS data, effect, button, shift, x, y, state
oHitTest = THIS.HitTest( X * thisform.nXmult, Y * thisform.nYmult )
if type("oHitTest")= "O"
 THIS.DropHighLight = oHitTest
endif
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform