Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Twip
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Re: Twip
Divers
Thread ID:
00333347
Message ID:
00333510
Vues:
26
>Is there any function to convert twip to pixel and pixel to twip?

Here's the code I use.
local liHWnd, ;
    liHDC, ;
    liPixelsPerInchX, ;
    liPixelsPerInchY

* Define some constants.

#define cnLOG_PIXELS_X      88
    * From WINGDI.H
#define cnLOG_PIXELS_Y      90
    * From WINGDI.H
#define cnTWIPS_PER_INCH  1440
    * 1440 twips per inch

* Declare some Windows API functions.

declare integer GetActiveWindow in WIN32API
declare integer GetDC           in WIN32API ;
    integer iHDC
declare integer GetDeviceCaps   in WIN32API ;
    integer iHDC, integer iIndex

* Get a device context for VFP.

liHWnd = GetActiveWindow()
liHDC  = GetDC(liHWnd)

* Get the pixels per inch.

liPixelsPerInchX = GetDeviceCaps(liHDC, cnLOG_PIXELS_X)
liPixelsPerInchY = GetDeviceCaps(liHDC, cnLOG_PIXELS_Y)

* Get the twips per pixel.

lnXFactor = cnTWIPS_PER_INCH/liPixelsPerInchX
lnYFactor = cnTWIPS_PER_INCH/liPixelsPerInchY
Doug
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform