如何确保字体使用它与.NET之前存在 [英] How to make sure a font exists before using it with .NET

查看:213
本文介绍了如何确保字体使用它与.NET之前存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个VB.NET Windows窗体的项目,在一个点上直接绘制文本到窗体在运行时。我之前用的字体虽然油漆,我想确保字体和字体大小存在在用户的机器上。如果他们不这样做,我会尝试一些其他类似的字体,最终以宋体什么的违约。

I have a VB.NET Windows Forms project that at one point paints text directly to onto the form at runtime. Before I paint with the font though, I want to make sure that the font and font-size exists on the user's machine. If they don't, I'll try a few other similar fonts, eventually defaulting with Arial or something.

什么是测试并验证一个用户的计算机上的字体最好的方式是什么?

What's the best way to test and validate a font on a user's computer?

推荐答案

从MSDN文章标题为如何:枚举安装字体,我发现这个code:

From an MSDN article titled "How To: Enumerate Installed Fonts", I found this code:




InstalledFontCollection installedFontCollection = new InstalledFontCollection();

// Get the array of FontFamily objects.
FontFamily[] fontFamilies = installedFontCollection.Families;


这篇关于如何确保字体使用它与.NET之前存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆