我如何嵌入我的C#应用程序的字体? (使用Visual Studio 2005) [英] How do I Embed a font with my C# application? (using Visual Studio 2005)
问题描述
什么是嵌入我开发的应用程序中的TrueType字体的最佳方式?基本上我想确保另一台机器上安装时,一个特定的字体是提供给我的申请。我有* .TTF字体文件,只是需要将其嵌入或自动安装它的应用程序运行时的方法。
What is the best way to embed a truetype font within the application i'm developing? Basically i want to make sure a particular font is available to my application when installed on another machine. I have the *.ttf font file and just need a way of embedding it or automatically installing it when the application is run.
我是否需要设置安装程序安装过程中安装的字体或可我的应用程序运行时动态加载字体?事实上这两个将是很好知道的。
Do i need to set the installation program to install the font during installation or can i dynamically load the font during runtime of the application? In fact both would be nice to know.
应用程序正在开发使用.NET 2.0 C#。
The application is being developed in C# using .NET 2.0.
推荐答案
这博客帖子应该帮助你。
基本上你添加的字体作为嵌入资源,然后将其加载到的 PrivateFontCollection 对象。
Basically you add the font as an embedded resource then load it into a PrivateFontCollection object.
这篇关于我如何嵌入我的C#应用程序的字体? (使用Visual Studio 2005)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!