TechSapphire Wednesday, 2018-10-17, 12:16 PM
Site menu
Login form
News
Play Games
  • Deep Freeze
  • Ice Slide
  • Gyroball
  • Fat Fish
  • Bush Royal Rampage
  • Main » 2011 » October » 5 » Add font at run time .Net Or Font VB Net Or Install Font run time
    7:12 PM
    Add font at run time .Net Or Font VB Net Or Install Font run time
    Add font at run time .Net Or Font VB Net Or Install Font run time
    You could install or add font at run time for particularly use in your project. This sample code is for installing font to project at run time in Vb.Net.
    Solution:
    Namespace required:

    Imports System

    Global Declaration:

       Dim PFC As Drawing.Text.PrivateFontCollection

      Dim NewFont_FF As Drawing.FontFamily        

    Function Call:

    CreateFont(Application.StartupPath & "\font.ttf", 20, FontStyle.Regular, GraphicsUnit.Point)

    Function Defination:

        Private Function CreateFont(ByVal name As String, ByVal size As Single, ByVal style As Drawing.FontStyle, ByVal unit As Drawing.GraphicsUnit) As Drawing.Font

            PFC = New Drawing.Text.PrivateFontCollection

            PFC.AddFontFile(name)

            NewFont_FF = PFC.Families(0)

            Return New Drawing.Font(NewFont_FF, size, style, unit)

        End Function

    Eplanation:
    You need to have font file in your Debug folder for this. And you must edit Fontname in argument of CreateFont function
    If want to check live project example download this project. Here you would find installation of font run time using Vb.Net.

    Move to solution page.
    Category: Programming | Views: 1013 | Added by: Admin | Tags: add font runtime .net, install font vb, add font runtime vb, install font runtime vb.net, install font .net | Rating: 2.0/1
    Total comments: 0
    Only registered users can add comments.
    [ Registration | Login ]
    Categories
    Programming [27]
    Tips for programming
    Security [2]
    Security Tips
    Google [1]
    Use google faster then ever you use
    Project [14]
    HTML [2]
    Electronics [0]
    Data Structure [0]
    Database [16]
    SQL SERVER
    SSRS [1]
    Sql Server Reporting Services
    Copyright MyCorp © 2018