使用字体时出现问题 [英] Problem in using Font

查看:103
本文介绍了使用字体时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在尝试在桌面应用程序中创建一个Font对象.这是语法

//System.Drawing.Font titleFont = new Font("Arrial",20,GraphicsUnit.Point);

这很好.但是当我将GraphicalUnit参数更改为Display时,如下所示

//System.Drawing.Font titleFont = new Font("Arrial",20,GraphicsUnit.Display);

系统抛出参数无效的异常.

我不知道这是什么问题.

请有任何想法的人帮我.

在此先感谢.

Hi All,

I am trying to create a Font object in my desktop application. Here is the syntax

// System.Drawing.Font titleFont = new Font("Arrial", 20, GraphicsUnit.Point);

This works fine. But when i change the GraphicalUnit parameter to Display as given below

// System.Drawing.Font titleFont = new Font("Arrial", 20, GraphicsUnit.Display);

System throws an exception of Invalid parameter.

I dont know what is the issue.

Please if some body have any idea then help me.

Thanks in Advance.

推荐答案

您显然不能使用GraphicsUnit.Display,因为它根据绘制图形的位置而异".这样做确实有意义,因为它应该是1/75英寸,并且这将取决于yoiu正在使用的实际显示上下文.尝试使用GraphicsUnit.Pixel,它不会引发异常,并且至少是固定的度量.
You can''t use GraphicsUnit.Display as it "varies depending on where the shapes will be drawn", apparently. Which does make some sense, since it is supposed to be 1/75th of an inch, and that will depend on the actual display context yoiu are drawing on. Try GraphicsUnit.Pixel instead - that will not throw an exception and is at least a fixed measure.


我不知道当您拼写为"Arial"时这是如何工作的.该错误表示20不是人机界面类型的有效数字.我在文档中看不到什么是有效的,但这是什么意思.
I have no idea how this works when you mis spelled ''Arial''. The error means that 20 is not a valid number for the Display unit type. I can''t see in the docs what is valid, but that''s what it means.


这篇关于使用字体时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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