|
-
Jun 27th, 2014, 02:22 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Using a New Font in The Designer
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!
Last edited by neef; Jun 27th, 2014 at 05:54 PM.
Intermediate Level Programmer Extraordinaire 
-
Jun 27th, 2014, 02:36 PM
#2
Re: Using a New Font in The Designer
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>
-
Jun 27th, 2014, 03:17 PM
#3
Re: Using a New Font in The Designer
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
-
Jun 27th, 2014, 05:54 PM
#4
Thread Starter
Hyperactive Member
Re: Using a New Font in The Designer
This is very helpful, thank you!
Intermediate Level Programmer Extraordinaire 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|