使用自定义字体:
PrivateFontCollection prc = new PrivateFontCollection();
prc.AddFontFile("自定义字体路径");
Font f = new Font(prc.Families[0], 12);
使用本地字体:
InstalledFontCollection fc = new InstalledFontCollection();
Font a = fc.Families.Where(d => d.Name.Contains("要使用的本地字体名称")).FirstOrDefault();
本文介绍了如何在程序中使用自定义字体及本地已安装字体的方法。对于自定义字体,通过加载字体文件并创建PrivateFontCollection实例来实现;而对于本地字体,则通过InstalledFontCollection筛选所需的字体。

被折叠的 条评论
为什么被折叠?



