我的图像上有一些空白。我必须将动态数据从sql添加到图像上,并且在此过程中应将特定字体应用于动态文本。 字体是旧英语。所以在我的C#课上 我添加了以下代码行。
Font nameFont = new Font("Olde English", 18);
SolidBrush nameBrush = new SolidBrush(Color.FromArgb(35,21,14));
RectangleF commRect = new RectangleF(new Point(0, height/4+16), new SizeF(width, 50));
RectangleF nameRect = new RectangleF(new Point(0, height/4+60), new SizeF(width, 100));
RectangleF gradRect = new RectangleF(new Point(0, height/2-16), new SizeF(width, 50));
RectangleF progRect = new RectangleF(new Point(0, height*4/7-18), new SizeF(width, 100));
StringFormat format = new StringFormat();
format.LineAlignment = StringAlignment.Center;
format.Alignment = StringAlignment.Center;
g.DrawString(grad_str, nameFont, nameBrush, gradRect, format);
g.DrawString(name_str, nameFont, gradBrush, nameRect, format);
g.DrawString(prog_str, nameFont, progBrush, progRect, format);
g.DrawString(comm_str, nameFont, commBrush, commRect, format);
现在,我在图像上看到了数据,但是未应用字体。 请帮助我