TechSapphire Monday, 2024-12-09, 3:30 PM
Site menu
Login form
News
Play Games
  • Deep Freeze
  • Ice Slide
  • Gyroball
  • Fat Fish
  • Bush Royal Rampage
  • 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.
    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 © 2024