>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 >lnDC = GetWindowDC(0) >lnPixelsPerInch = GetDeviceCaps(lnDC, WU_LOGPIXELSX) >lnDC = ReleaseDC(0, lnDC) > >lcFont = 'Arial' && _Screen.FontName >lnFontSize = _Screen.FontSize >lcStyle = ; > Iif(_Screen.FontBold,'B','')+; > Iif(_Screen.FontItalic,'I','')+; > Iif(_Screen.FontUnderline,'U','') >lcStyle = Iif( Empty(m.lcStyle),'N',m.lcStyle) >lcTextToMeasure = "Sample text" >lnSizeInPixels = Txtwidth(m.lcTextToMeasure, m.lcFont, m.lnFontSize,m.lcStyle) * ; > fontmetric(6, m.lcFont, m.lnFontSize,m.lcStyle) >lnSizeInTwips = ( m.lnSizeInPixels / m.lnPixelsPerInch * 1440 ) >lnSizeInPoints = m.lnSizeInTwips / 20 >lnSizeInInches = m.lnSizeInTwips / 1440 >lnSizeInCm = m.lnSizeInTwips / 1440 * 2.54 >clear >TEXT TO m.lcDisplay TEXTMERGE noshow >Pixels per inch is: <<m.lnPixelsPerInch>> >Font: <<m.lcFont>>, <<m.lnFontSize>>, <<m.lcStyle>> >String "<<m.lcTextToMeasure>>" measures: >In pixels: <<m.lnSizeInPixels>> >In Twips: <<m.lnSizeInTwips>> >In points: <<m.lnSizeInPoints>> >In Inches: <<m.lnSizeInInches>> >In centimeters: <<m.lnSizeInCm>> >endtext >? m.lcDisplay >* 1 Twip = 1/20 point, 567 twips 1 cm ~ 1440/2.54, 1 inch = 72pts = 1440 twips >Cetin