hello,
I am using the below method to include a custom font into my vb application. (the fontfile.ttf is included in an attached dir...
Imports System.Drawing.Text
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim pfc As New PrivateFontCollection()
pfc.AddFontFile(Application.StartupPath + "\FontFile.ttf")
Label1.Font = New Font(pfc.Families(0), 16, FontStyle.Regular)
Label1.Text = "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z"
End Sub
End Class
it works well for one custom font but I cant seem to get a second one working
my question is how do I add more than one custom font and then access it. I tried adding a second line like the 'pfc.AddFontFile' command which pointed to a second .ttf file in the same dir. This initial bit seemed to work but I couldn't apply it to a label or textbox. the first would work but not the second as I could not get the syntax right to apply it.
To apply the second custom font I tried using....
Label2.Font = New Font(pfc.Families(1), 16, FontStyle.Regular)
thinking that it would be the next one in the pfc.families() list however this did not work.
all help is appreciated
tyvm
No comments:
Post a Comment