Okay, so I am trying to use a privatefontcollection for my program to add a little bit of uniqueness to it. The font that I am using is not installed on computers by default. The font's name is youmurdererbb_reg. I have the font file in the resources folder and the file is in a .ttf format. Here is what i have so far:
Imports System.Drawing
Imports System.Windows.Forms
Imports System.Drawing.Text
Imports System.Text
Dim pc As New PrivateFontCollection
Private Sub Main_Menu_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Try
pc.AddFontFile(YouMurderer)
Catch ex As Exception
Trace.WriteLine(ex.ToString)
End Try
End Sub
Private Sub Main_Menu_Paint(sender As Object, e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim Fnt As Font = New Font(pc.Families(0), 80, FontStyle.Regular)
e.Graphics.DrawString("This is the text that is being drawn", Fnt, Brushes.Black, 10, 10)
End Sub
Now where i declared the Private Font Collection, I have tried these different things to get it to work:
Dim YouMurderer As String = Encoding.ASCII.GetString(My.Resources.youmurdererbb_reg)
Dim YouMurderer As String = Convert.ToString(My.Resources.youmurdererbb_reg)
Dim YouMurderer As String = Convert.ToBase64String(My.Resources.youmurdererbb_reg)
Dim YouMurderer As String = Encoding.UTF8.GetString(My.Resources.youmurdererbb_reg)
But whichever one I choose, it just shows the entire form with a large red "X" (Like a pictureboxes' "ErrorImage") (I have a picture set to the forms background as additional information).
Another problem is that if i don't try to convert it:
Dim YouMurderer As String = My.Resources.youmurdererbb_reg
Then it comes up with the error of:
Value of type '1-dimensional array of Byte' cannot be converted to 'String'.
I need help with this in .NET (Framework 4)! The entire program is being written in VB.net, not C#, or C++, or JAVA.