3
可能重复:
How do I Embed a font with my C# application? (using Visual Studio 2005)C#安装
嗨,
我想用我自己的字体到一个文本框没有安装在客户端机器。我希望它驻留在我的程序文件应用程序文件夹中[我知道大多数游戏应用程序使用他们自己的字体]。我该怎么做 ?
谢谢。
可能重复:
How do I Embed a font with my C# application? (using Visual Studio 2005)C#安装
嗨,
我想用我自己的字体到一个文本框没有安装在客户端机器。我希望它驻留在我的程序文件应用程序文件夹中[我知道大多数游戏应用程序使用他们自己的字体]。我该怎么做 ?
谢谢。
我认为你需要这样的:
// Be sure to dispose your PrivateFontCollection
// and Font to avoid an easy leak!
System.Drawing.Text.PrivateFontCollection privateFonts = new PrivateFontCollection();
privateFonts.AddFontFile("c:\myapplication\mycustomfont.ttf");
System.Drawing.Font font = new Font(privateFonts.Families[0], 12);
this.textBox1.Font = font;