问一个C#中字体处理的问题。
我按照清华大学出版社出版的〈〈Visual C#.net入门与提高〉〉181页中的”字体“一节的程序做的,可是运行时出现对话框:内容如下:
”未处理的“System.ArgumentException”类型的异常出现在system.drawing.dll 中。
其他信息: 字体“Monotype Corsiva”不支持样式“Regular”。
中断,继续, 帮助。
“
然后看到一个一个绿键头指向下面函数中的:Font f=new Font(fontFamiles[e.index],12);一句。
private void cbxFont_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)
{
Font f = new Font( fontFamilies[e.Index],12 );
Bitmap bmp = new Bitmap("ttfont.bmp");
bmp.MakeTransparent(Color.White);
Graphics g = e.Graphics;
e.DrawBackground();
SolidBrush b = new SolidBrush( e.ForeColor );
g.DrawImage( bmp,e.Bounds.X,e.Bounds.Y );
g.DrawString( fontFamilies[e.Index].Name,f,b,e.Bounds.X+18,e.Bounds.Y);
e.DrawFocusRectangle();
}
我不知道如何修改,请高手们帮帮忙。