2013-10-02 3 views

Antwort

15

hier und Beispiel dafür, wie man es in C# tun kann:

System.Drawing.Text.PrivateFontCollection privateFonts = new System.Drawing.Text.PrivateFontCollection(); 
privateFonts.AddFontFile("C:\\Documents and Settings\\somefont.ttf"); 
System.Drawing.Font font = new Font(privateFonts.Families[0], 12); 
label1.Font = font; 

Oder in VB.NET:

Dim privateFonts As New System.Drawing.Text.PrivateFontCollection() 
privateFonts.AddFontFile("C:\Documents and Settings\somefont.ttf") 
Dim font As New System.Drawing.Font(privateFonts.Families(0), 12) 
label1.Font = font 

Blick THIS für weitere Details.

+0

Wie kann ich ersetzen "C: \ Dokumente und Einstellungen \" durch den Speicherort der .exe beim Hinzufügen der Schriftart (in VB.NET), um den relativen Pfad anstelle der absoluten? –

+1

@Che AFAIK Wenn Sie die ttf-Datei haben, wo Ihre ausführbare Datei ist, müssen Sie nur den Dateinamen schreiben. – Saksham

Verwandte Themen