缇等于多少像素?
方法一:
缇(Twips) (缇:计量单位,等于“磅”的 1/20,英寸的 1/1,440。一厘米有 567 缇。
像素(Pixels):监视器或打印机分辨率的最小单位
右键单击桌面,选择属性,选择“设置”选卡,单击高级按钮。
里面出现DPI设置。一般为“正常尺寸(96 DPI)”。
DPI的意思就是 DPI (Dots per Inch)。因此我们可以得到如下换算公式
1 Pixel = 1440 TPI / 96 DPI = 15 Twips
1 Twip = 96 DPI / 1440 TPI = 0.0666667 Pixels
方法二:
摘自 http://www.office-cn.net/Article/Class5/Class16/200411/556.html
堤与像素相互转换的通用函数
作者:tmtony 文章来源:本站原创 点击数:63 更新时间:2004-11-15
- VB code
-
Option Compare Database OptionExplicitPrivate Declare Function apiGetDC Lib "user32" Alias "GetDC" _ (ByVal hwnd AsLong) AsLongPrivate Declare Function apiReleaseDC Lib "user32" Alias "ReleaseDC" _ (ByVal hwnd AsLong, ByVal hdc AsLong) AsLongPrivate Declare Function apiGetDeviceCaps Lib "gdi32" Alias "GetDeviceCaps" _ (ByVal hdc AsLong, ByVal nIndex AsLong) AsLongPrivateConst LOGPIXELSX =88PrivateConst LOGPIXELSY =90PublicConst DIRECTION_VERTICAL =1PublicConst DIRECTION_HORIZONTAL =0'=============================================================================== '-函数名称: gFunTwipsToPixels '-功能描述: 转换堤到像素 '-输入参数说明: 参数1:rlngTwips Long 需要转换的堤 ' 参数2:rlngDirection Long DIRECTION_VERTICAL是Y方向 DIRECTION_HORIZONTAL为X方向 '-返回参数说明: 转换后像素值 '-使用语法示例: gFunTwipsToPixels 50,DIRECTION_VERTICAL '-参考: '-使用注意: '-兼容性: 97,2000,XP compatible '-作者: 王宇虹(参考微软KB),改进:王宇虹 '-更新日期: 2002-08-26 ,2002-11-15 '===============================================================================Function gFunTwipsToPixels(rlngTwips AsLong, rlngDirection AsLong) AsLongOnErrorGoTo Err_gFunTwipsToPixels Dim lngDeviceHandle AsLongDim lngPixelsPerInch AsLong lngDeviceHandle = apiGetDC(0) If rlngDirection = DIRECTION_HORIZONTAL Then'水平X方向 lngPixelsPerInch = apiGetDeviceCaps(lngDeviceHandle, LOGPIXELSX) Else'垂直Y方向 lngPixelsPerInch = apiGetDeviceCaps(lngDeviceHandle, LOGPIXELSY) EndIf lngDeviceHandle = apiReleaseDC(0, lngDeviceHandle) gFunTwipsToPixels = rlngTwips /1440* rlngPixelsPerInch Exit_gFunTwipsToPixels: OnErrorResumeNextExitFunction Err_gFunTwipsToPixels: MsgBox Err.Description, vbOKOnly + vbCritical, "Error: "& Err.Number Resume Exit_gFunTwipsToPixels End Function'=============================================================================== '-函数名称: gFunPixelsToTwips '-功能描述: 转换像素到堤 '-输入参数说明: 参数1:rlngPixels Long 需要转换的像素 ' 参数2:rlngDirection Long DIRECTION_VERTICAL是Y方向 DIRECTION_HORIZONTAL为X方向 '-返回参数说明: 转换后堤值 '-使用语法示例: gFunPixelsToTwips 50,DIRECTION_VERTICAL '-参考: '-使用注意: '-兼容性: 97,2000,XP compatible '-作者: 王宇虹(参考微软KB),改进:王宇虹 '-更新日期: 2002-08-26 ,2002-11-15 '===============================================================================Function gFunPixelsToTwips(rlngPixels AsLong, rlngDirection AsLong) AsLongOnErrorGoTo Err_gFunPixelsToTwips Dim lngDeviceHandle AsLongDim lngPixelsPerInch AsLong lngDeviceHandle = apiGetDC(0) If rlngDirection = DIRECTION_HORIZONTAL Then'水平X方向 lngPixelsPerInch = apiGetDeviceCaps(lngDeviceHandle, LOGPIXELSX) Else'垂直Y方向 lngPixelsPerInch = apiGetDeviceCaps(lngDeviceHandle, LOGPIXELSY) EndIf lngDeviceHandle = apiReleaseDC(0, lngDeviceHandle) gFunPixelsToTwips = rlngPixels *1440/ rlngPixelsPerInch Exit_gFunPixelsToTwips: OnErrorResumeNextExitFunction Err_gFunPixelsToTwips: MsgBox Err.Description, vbOKOnly + vbCritical, "Error: "& Err.Number Resume Exit_gFunPixelsToTwips End Function