Results 1 to 4 of 4

Thread: [RESOLVED] Using a New Font in The Designer

  1. #1

    Thread Starter
    Hyperactive Member neef's Avatar
    Join Date
    Dec 2001
    Location
    Boston
    Posts
    311

    [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

  2. #2
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Posts
    12,398

    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>
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | HtmlLessons | CssLessons | Code Tags | Sword of Fury - Jameram

  3. #3
    PowerPoster
    Join Date
    Oct 2010
    Posts
    2,141

    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:
    1. Public Class Form1
    2.  
    3.    Private pfc As New System.Drawing.Text.PrivateFontCollection
    4.    Private mvBoli As Font
    5.  
    6.    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    7.       pfc.AddFontFile("mvboli.ttf")
    8.       mvBoli = New Font(pfc.Families.Last, 12, FontStyle.Regular, GraphicsUnit.Point)
    9.       TextBox1.Font = mvBoli
    10.    End Sub
    11.  
    12.    Private Sub Form1_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs)
    13.       If mvBoli IsNot Nothing Then mvBoli.Dispose()
    14.       If pfc IsNot Nothing Then pfc.Dispose()
    15.    End Sub
    16.  
    17. End Class

    For a more indepth example see: How to: Create a Private Font Collection

  4. #4

    Thread Starter
    Hyperactive Member neef's Avatar
    Join Date
    Dec 2001
    Location
    Boston
    Posts
    311

    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
  •  



Click Here to Expand Forum to Full Width