本人用下列API函数实现向逻辑字体的转化,其可以设置字高字宽等等一系列功能,现本人更想通过该函数控制字间距的大小,也必须是逻辑字体情况下,请高手加以指点,谢谢!Public Declare Function CreateFontIndirect Lib "gdi32" Alias "CreateFontIndirectA" (lpLogFont As LOGFONT) As LongPublic Type LOGFONT
        lfHeight As Long
        lfWidth As Long
        lfEscapement As Long
        lfOrientation As Long
        lfWeight As Long
        lfItalic As Byte
        lfUnderline As Byte
        lfStrikeOut As Byte
        lfCharSet As Byte
        lfOutPrecision As Byte
        lfClipPrecision As Byte
        lfQuality As Byte
        lfPitchAndFamily As Byte
        lfFaceName(1 To LF_FACESIZE) As Byte
End Type

解决方案 »

  1.   

    【VB声明】
      Private Declare Function CreateFontIndirect Lib "gdi32" Alias "CreateFontIndirectA" (lpLogFont As LOGFONT) As Long【别名】
      CreateFontIndirectA【说明】
      用指定的属性创建一种逻辑字体 【返回值】
      Long,执行成功则返回逻辑字体句柄,零表示失败 【备注】
      VB的字体属性在选择字体的时候显得更有效【参数表】
      lpLogFont ------  LOGFONT,这个结构定义了逻辑字体请求的属性
      

  2.   

    'In general section
    Private Declare Function CreateFontIndirect Lib "gdi32" Alias "CreateFontIndirectA" (lpLogFont As LOGFONT) As Long
    Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
    Private Const LF_FACESIZE = 32
    Private Type LOGFONT
        lfHeight As Long
        lfWidth As Long
        lfEscapement As Long
        lfOrientation As Long
        lfWeight As Long
        lfItalic As Byte
        lfUnderline As Byte
        lfStrikeOut As Byte
        lfCharSet As Byte
        lfOutPrecision As Byte
        lfClipPrecision As Byte
        lfQuality As Byte
        lfPitchAndFamily As Byte
        lfFaceName(LF_FACESIZE) As Byte
    End Type
    'In form
    Private Sub Form_Load()
        'KPD-Team 1998
        'URL: http://www.allapi.net/
        'E-Mail: [email protected]    Dim RotateMe As LOGFONT
        'Set graphic-mode to 'persistent graphic'
        Me.AutoRedraw = True
        'Rotate degrees
        Deg = 270
        'Size (in points)
        Size = 20
        'Set the rotation degree
        RotateMe.lfEscapement = Deg * 10
        'Set the height of the font
        RotateMe.lfHeight = (Size * -20) / Screen.TwipsPerPixelY
        'Create the font
        rFont = CreateFontIndirect(RotateMe)
        'Select the font n the Form's device context
        Curent = SelectObject(Me.hdc, rFont)
        'Print some text ...
        Me.CurrentX = 500
        Me.CurrentY = 200
        Me.Print ":-)"
    End Sub