DEV Community

vblover programmer
vblover programmer

Posted on

(VB .Net): Using Local Font Files

#vb
Imports System.Drawing.Text
Public Class Form1
    Dim Collection As New PrivateFontCollection
     Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        For Each File As String In IO.Directory.GetFiles(".\Fonts", "*.ttf")
            Collection.AddFontFile(File)
        Next
        Me.Font = New Font(Collection.Families(0), 12, FontStyle.Bold)
        Me.Label2.Font = New Font(Collection.Families(1), 12, FontStyle.Bold)
    End Sub
End Class
Enter fullscreen mode Exit fullscreen mode

Top comments (0)