Hi,
I want to use a font called MV Boli, which is available in Microsoft Word, but not as an option for labels in VB.net's designer. Is there a way to import this font? I have the .tff file downloaded if that's necessary.
Thanks!
Printable View
Hi,
I want to use a font called MV Boli, which is available in Microsoft Word, but not as an option for labels in VB.net's designer. Is there a way to import this font? I have the .tff file downloaded if that's necessary.
Thanks!
It doesn't sound like you've installed the font correctly on Windows, otherwise it would be appearing as an option in the Font dialog. I suggest Googleing: install font windows <version here>
MV Boli is an OpenType Font and the standard font mechanism only has limited support of OpenType fonts. You can load it into a PrivateFontCollection.
VB.Net Code:
Public Class Form1 Private pfc As New System.Drawing.Text.PrivateFontCollection Private mvBoli As Font Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load pfc.AddFontFile("mvboli.ttf") mvBoli = New Font(pfc.Families.Last, 12, FontStyle.Regular, GraphicsUnit.Point) TextBox1.Font = mvBoli End Sub Private Sub Form1_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) If mvBoli IsNot Nothing Then mvBoli.Dispose() If pfc IsNot Nothing Then pfc.Dispose() End Sub End Class
For a more indepth example see: How to: Create a Private Font Collection
This is very helpful, thank you!