示例:以任意角度输出文字Option ExplicitPrivate Const FW_NORMAL = 400
Private Const ANSI_CHARSET = 0
Private Const FF_MODERN = 48
Private Const PROOF_QUALITY = 2Private Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal lpString As String, ByVal nCount As Long) As Long
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 Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As LongPrivate 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 As String * 20
End TypeDim MyFont As LOGFONT
Const OutString = " 字体 FONT 123 !@#$% "
Const X = 10
Const Y = 200Private Sub Form_Click()
Dim hFont As Long
Dim hOldFont As Long
hFont = CreateFontIndirect(MyFont) '建立逻辑字体
hOldFont = SelectObject(Me.hdc, hFont) '选入设备环境
TextOut Me.hdc, X, Y, OutString, Len(OutString) '输出逻辑字体
hFont = SelectObject(Me.hdc, hOldFont) '恢复设备环境
DeleteObject hFont '删除逻辑字体
End SubPrivate Sub Form_Load()
Dim Angle As Integer
Angle = 90 '输出角度
MyFont.lfHeight = 18
' MyFont.lfWidth = 0
MyFont.lfEscapement = Angle * 10
' MyFont.lfWeight = FW_NORMAL
' MyFont.lfCharSet = ANSI_CHARSET
' MyFont.lfPitchAndFamily = FF_MODERN
' MyFont.lfQuality = PROOF_QUALITY
End Sub
Private Const ANSI_CHARSET = 0
Private Const FF_MODERN = 48
Private Const PROOF_QUALITY = 2Private Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal lpString As String, ByVal nCount As Long) As Long
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 Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As LongPrivate 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 As String * 20
End TypeDim MyFont As LOGFONT
Const OutString = " 字体 FONT 123 !@#$% "
Const X = 10
Const Y = 200Private Sub Form_Click()
Dim hFont As Long
Dim hOldFont As Long
hFont = CreateFontIndirect(MyFont) '建立逻辑字体
hOldFont = SelectObject(Me.hdc, hFont) '选入设备环境
TextOut Me.hdc, X, Y, OutString, Len(OutString) '输出逻辑字体
hFont = SelectObject(Me.hdc, hOldFont) '恢复设备环境
DeleteObject hFont '删除逻辑字体
End SubPrivate Sub Form_Load()
Dim Angle As Integer
Angle = 90 '输出角度
MyFont.lfHeight = 18
' MyFont.lfWidth = 0
MyFont.lfEscapement = Angle * 10
' MyFont.lfWeight = FW_NORMAL
' MyFont.lfCharSet = ANSI_CHARSET
' MyFont.lfPitchAndFamily = FF_MODERN
' MyFont.lfQuality = PROOF_QUALITY
End Sub
只有用API函数画出来