Article ID: 119673
Article Last Modified on 2/24/2005
Declare Function CreateFontIndirect Lib "GDI" (lpLogFont As Any)
As Integer
Declare Function SelectObject Lib "GDI" (ByVal hDC As Integer,
ByVal hgdiObj As Integer)
As Integer Declare Function
DeleteObject Lib "GDI" (ByVal hgdiObj As Integer)
As Integer
Type LOGFONT_TYPE
lfHeight As Integer
lfWidth As Integer
lfEscapement As Integer
lfOrientation As Integer
lfWeight As Integer
lfItalic As String * 1
lfUnderline As String * 1
lfStrikeOut As String * 1
lfCharSet As String * 1
lfOutPrecision As String * 1
lfClipPrecision As String * 1
lfQuality As String * 1
lfPitchAndFamily As String * 1
lfFaceName As String * 32
End Type
Sub Command1_Click () Dim font As LOGFONT_TYPE Dim prevFont As Integer, hFont As Integer, ret As Integer Const FONTSIZE = 12 ' Desired point size of font font.lfEscapement = 1800 ' 180-degree rotation font.lfFaceName = "Arial" + Chr$(0) ' Windows expects the font size to be in pixels and to ' be negative if you are specifying the character height ' you want. font.lfHeight = (FONTSIZE * -20) / Screen.TwipsPerPixelY hFont = CreateFontIndirect(font) prevFont = SelectObject(Picture1.hDC, hFont) Picture1.CurrentX = Picture1.Width \ 2 Picture1.CurrentY = Picture1.Height \ 2 Picture1.Print "Rotated Text" ' Clean up by restoring original font. ret = SelectObject(Picture1.hDC, prevFont) ret = DeleteObject(hFont) Picture1.Print "Normal Text" End Sub
Keywords: kbhowto kbprint KB119673