GetCharWidth, GetCharWidth32, GetCharWidthFloat
VB声明
Declare Function GetCharWidth& Lib "gdi32" Alias "GetCharWidthA" (ByVal hDC As Long, ByVal iFirstChar As Long, ByVal iLastChar As Long, lpBuffer As Long)
Declare Function GetCharWidth32& Lib "gdi32" Alias "GetCharWidth32A" (ByVal hdc As Long, ByVal iFirstChar As Long, ByVal iLastChar As Long, lpBuffer As Long)
Declare Function GetCharWidthFloat& Lib "gdi32" Alias "GetCharWidthFloatA" (ByVal hdc As Long, ByVal iFirstChar As Long, ByVal iLastChar As Long, pxBuffer As Single)
说明
调查字体中一个或多个字符的宽度。在Win32环境中,请使用GetCharWidth32函数。用GetCharWidthFloat则可获得小数宽度
返回值
Long,非零表示成功,零表示失败。会设置GetLastError
参数表
参数 类型及说明
hDC Long,设备场景的句柄
iFirstChar Long,要调查宽度的第一个字符的ASCII值
iLastChar Long,要调查宽度的最后一个字符的ASCII值
lpBuffer Long,指定Long值数组的第一个条目。该数组容纳了字体的字符宽度设置
pxBuffer Single,指定Single值数组的第一个条目。该数组容纳了字体的字符宽度设置
注解

对于TureType字体,GetCharABCWidths可获得更详细的信息

Top