Draw Hollow Text


Add 1 Picture Box to your form.

Module Code

Declare Function BeginPath Lib "gdi32" (ByVal hdc As Long) As Long
Declare Function EndPath Lib "gdi32" (ByVal hdc As Long) As Long
Declare Function StrokePath Lib "gdi32" (ByVal hdc As Long) As Long

Form Code

Private Sub Form_Load()
'replace "VBTown!" with the text you want to display
    Const TXT = "VBTown!"
    Dim i As Long
    Dim hRgn As Long

    Picture1.AutoRedraw = True

    ' Select a font. You can choose your own font type and size
    Picture1.Font.Name = "Times New Roman"
    Picture1.Font.Bold = True
    Picture1.Font.Size = 50

    ' Make the PictureBox big enough.
    Picture1.Width = Picture1.TextWidth(TXT)
    Picture1.Height = Picture1.TextHeight(TXT)

    ' Make the clipping path.
BeginPath Picture1.hdc
    Picture1.CurrentX = 0
    Picture1.CurrentY = 0
    Picture1.Print TXT
    EndPath Picture1.hdc

    ' Draw the path.
StrokePath Picture1.hdc
End Sub

Go Back