Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Pixels and Foxels conversion
Message
De
16/03/2003 21:19:18
Peter Easson
Catalina Trading
Sydney, Australie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00766384
Message ID:
00766409
Vues:
36
Here is one extra little tweak. I found that it still could be inaccurate as the Form that had focus could be different from _SCREEN in the calculation
*-* Conversion
FUNCTION Foxel2Pixel(oForm,tlnFoxelValue, tllVertical)

	RETURN ROUND(tlnFoxelValue / GetPixFoxRatio(oForm,tllVertical), 0)

ENDFUNC


FUNCTION Pixel2Foxel(oForm,tlnPixelValue, tllVertical)

	RETURN ROUND(tlnPixelValue * GetPixFoxRatio(oForm,tllVertical), 3)

ENDFUNC


FUNCTION GetPixFoxRatio(oForm,tllVertical)

	LOCAL lnSaveScaleMode, lnFoxel, lnPixel, ;
 		  lnRatio

	*----------------------------------------------------
	*-- Get all required values for our calculations
	*----------------------------------------------------

	WITH oForm

		*-- Save old ScaleMode of the form
		lnSaveScaleMode = .ScaleMode

		.ScaleMode = 0 &&SCALEMODE_FOXELS	

		IF tllVertical
			lnFoxel = .Height
		ELSE
			lnFoxel	= .Width
		ENDIF

		.ScaleMode = 3 && SCALEMODE_PIXELS

		IF tllVertical
			lnPixel = .Height
		ELSE
			lnPixel	= .Width
		ENDIF

		*-- Calculate Foxel to Pixel factors
		lnRatio = lnFoxel / lnPixel

		*-- Set ScaleMode back
		.ScaleMode = lnSaveScaleMode

	ENDWITH

	RETURN lnRatio

ENDFUNC
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform