C#代码在Windows 7中抛出Font对象的异常 [英] C# code throws exception for Font object in windows 7

查看:100
本文介绍了C#代码在Windows 7中抛出Font对象的异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

using System.Drawing;
Font font = new Font("Aharoni", 20f, FontStyle.Regular);



上面的代码在Windows 7中抛出异常消息"Font Aharoni不支持样式常规",但在Windows 10中工作并创建具有指定参数的字体对象。

Above code throws exception message in windows 7 as "Font Aharoni does not support style Regular", but works in windows 10 and creates font object with specified parameters.


注意:默认情况下,Windows 10没有"Aharoni"字体,我已经明确安装。

Note: Windows 10 doesn't have "Aharoni" font by default, I have explicitly installed.


我很想听到任何已经找出问题的根本原因的人。

I would love to hear from anybody that has figured out the root cause to this problem.

推荐答案

这是否会产生任何错误:
新字体("Aharoni",20f)

也许可用字体"Aharoni"不支持该样式常规。


这篇关于C#代码在Windows 7中抛出Font对象的异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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