private static Bitmap[] renders = new Bitmap[characters];
public static void initBitmaps()
{
fontWidth = TextRenderer.MeasureText("c", font).Width;
fontHeight = TextRenderer.MeasureText("c", font).Height;
for (int i=0; i<characters; i++)
{
renders[i] = new Bitmap(fontWidth, fontHeight);
using (Graphics g = Graphics.FromImage(renders[i]))
{
g.DrawString(Convert.ToChar(i + 32).ToString(), font, new SolidBrush(Color.Black), new PointF(0, 0));
}
}
}
执行完这段代码后,所有位图都是空的(RawData 为空)。我究竟做错了什么?
(有问题的字体是固定宽度的,所以大小应该不是问题)