我使用这种方法在图像上写一些文字
Bitmap bmp_hamahang = new Bitmap(WF_Certificate.Properties.Resources.Cert_template_hamahang);
...
Bitmap bmp_hamhng=new Bitmap(bmp_hamahang);
using (Graphics g = Graphics.FromImage(bmp_hamhng))
{
g.DrawString(cert.gavahi_elicens, new Font("B Zar", 13, System.Drawing.FontStyle.Bold), Brushes.Blue, new Point(60, 90));
g.DrawString(date_cert, new Font("B Zar", 13, System.Drawing.FontStyle.Bold), Brushes.Blue, new Point(70, 130));
g.DrawString(cert.st_fname.Trim(' ', '\0') + " " + cert.st_lname.Trim(' ', '\0'), new Font("B Zar", 15, System.Drawing.FontStyle.Bold), Brushes.Blue, new Point(120, 280));
g.DrawString(cert.st_nid, new Font("B Zar", 13, System.Drawing.FontStyle.Bold), Brushes.Blue, new Point(460, 357));
g.DrawString(cert.standard_code, new Font("B Zar", 13, System.Drawing.FontStyle.Bold), Brushes.Blue, new Point(130, 357));
g.DrawString(cert.standard_name, new Font("B Zar", 11, System.Drawing.FontStyle.Bold), Brushes.Blue, new Point(440, 430));
g.DrawString(cert.jam, new Font("B Zar", 13, System.Drawing.FontStyle.Bold), Brushes.Blue, new Point(535, 510));
g.DrawString(cert.zaman_azmoon_katbi_az, new Font("B Zar", 13, System.Drawing.FontStyle.Bold), Brushes.Blue, new Point(170, 510));
g.DrawString(cert.nomre_final, new Font("B Zar", 13, System.Drawing.FontStyle.Bold), Brushes.Blue, new Point(500, 595));
g.DrawString(lvl, new Font("B Zar", 13, System.Drawing.FontStyle.Bold), Brushes.Blue, new Point(250, 595));
g.DrawString(cert.ostanname, new Font("B Zar", 13, System.Drawing.FontStyle.Bold), Brushes.Blue, new Point(125, 775));
//g.DrawString("(" + cert.markaz_name.Trim(')') , new Font("B Zar", 13, System.Drawing.FontStyle.Bold), Brushes.Blue, new Point(125, 825));
//g.DrawString(cert.azad_name.Trim(), new Font("B Zar", 13, System.Drawing.FontStyle.Bold), Brushes.Blue, new Point(125, 875));
CaptureScreen(g, cnt, bmp_hamhng);
}
我的问题是,现在我有31张bmp_hamahang
图片,编号从1到31(哈马#1到hamahang#31)。我已将所有图像都包含在Resource文件夹中。我应该使用inst_code
选择图像。例如if(inst_code==1)
为真,我应该加载图像hamahang#1
并在其上打印信息。
现在最好的方法是什么?我应该像这样定义Bitmap bmp_hamahang = new Bitmap(WF_Certificate.Properties.Resources.Cert_template_hamahang);
Bitmap bmp_hamhng=new Bitmap(bmp_hamahang);
所有31个人?