Private Declare Function BeginPath Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function EndPath Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function PathToRegion Lib "gdi32" (ByVal hdc As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function CreateFont Lib "gdi32" Alias "CreateFontA" (ByVal H As Long, ByVal W As Long, ByVal E As Long, ByVal O As Long, ByVal W As Long, ByVal i As Long, ByVal u As Long, ByVal S As Long, ByVal C As Long, ByVal OP As Long, ByVal CP As Long, ByVal Q As Long, ByVal PAF As Long, ByVal F As String) 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 Long
' Constrain the PictureBox to the region.
SetWindowRgn Picture1.hWnd, hRgn, False
' Restore the original font.
SelectObject hdc, old_font
' Free font resources (important!)
DeleteObject new_font
' Draw text in the PictureBox.
With Picture1.Font
.Name = "Times New Roman"
.Size = 8
.Bold = False
End With
Picture1.CurrentY = 0
Do While Picture1.CurrentY <= Picture1.ScaleHeight
Picture1.CurrentX = -Picture1.CurrentY
Do While Picture1.CurrentX <= Picture1.ScaleWidth
Picture1.Print TEXT2;
Loop
Picture1.CurrentY = Picture1.CurrentY + Picture1.TextHeight(TEXT2)
Loop
End Sub
' Make a customized font and return its handle.
Private Function CustomFont(ByVal hgt As Long, ByVal wid As Long, ByVal escapement As Long, ByVal orientation As Long, ByVal wgt As Long, ByVal is_italic As Long, ByVal is_underscored As Long, ByVal is_striken_out As Long, ByVal face As String) As Long
Const CLIP_LH_ANGLES = 16 ' Needed for tilted fonts.