【发布时间】:2020-12-31 03:39:04
【问题描述】:
我刚刚将一个 ttf 文件作为“文件”添加到项目(c# 2008 express)中,并为嵌入式资源添加了构建选项。
我在尝试像这样设置此字体时遇到问题: (我知道下一行是错的……)
this.label1.Font = AlarmWatch.Properties.Resources.Baby_Universe;
错误 1 无法隐式转换类型 '字节 []' 到 'System.Drawing.Font' C:\Users\hongo\Documents\Visual 工作室 2008\Projects\AlarmWatch\AlarmWatch\Form1.Designer.cs 57 32 AlarmWatch
我知道它是 byte[] 因为我已将选项 build 设置为嵌入式资源,但与此行比较是正确的:
this.label1.Font = new System.Drawing.Font("OCR A Extended",
24F, System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, ((byte)(0)));
如何设置 this.label1 以使用新字体?
【问题讨论】: