I'm using this method to write some text on images
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);
}
My problem is that now I have 31 bmp_hamahang
image, numbered from 1 to 31 (hamahang#1 to hamahang#31). I have included all images in Resource folder. I should choose images using inst_code
. For instance if(inst_code==1)
is true I should load image hamahang#1
and print info on it.
Now what's the best way to do it?Should I define like this Bitmap bmp_hamahang = new Bitmap(WF_Certificate.Properties.Resources.Cert_template_hamahang);
Bitmap bmp_hamhng=new Bitmap(bmp_hamahang);
for all 31 of them?