我有一个非常简单的应用程序,在位图上打印一个大的西里尔符号。西里尔字母有33个字母,其中31个正确打印,但字母'Э'和'Я'(代码为1069 (see here)和1071 (see here))抛出'GDI +中发生一般错误。'
堆栈跟踪:
in System.Drawing.Graphics.CheckErrorStatus(Int32 status)
in System.Drawing.Graphics.DrawString(String s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format)
in System.Drawing.Graphics.DrawString(String s, Font font, Brush brush, Single x, Single y)
in textTest.Form1.Form1_Load(Object sender, EventArgs e) in w:\Delete\textTest\textTest\Form1.cs:line 27
代码:
private void Form1_Load(object sender, EventArgs e)
{
Bitmap bmp = new Bitmap(1000, 2000);
using (Graphics g = Graphics.FromImage(bmp))
{
try
{
g.DrawString((char)1069+"", new Font("Times New Roman", 100f, FontStyle.Regular), Brushes.White, 100, 100);
}
catch (Exception ex)
{
}
}
}