我正在爲員工生成ICARD。 我必須在ICard上寫下員工的地址。
Image blankICard = Image.FromFile(@"C:\Users\admin\Pictures\filename.jpg");
Bitmap outputImage = new Bitmap(blankICard.Width, blankICard.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
System.Drawing.SolidBrush b = new SolidBrush(Color.FromArgb(255, 88, 89, 91));
using (Graphics graphics = Graphics.FromImage(outputImage))
{
graphics.DrawImage(blankICard, new Rectangle(0, 0, blankICard.Width, blankICard.Height),
new Rectangle(new Point(), blankICard.Size), GraphicsUnit.Pixel);
Font stringFont = new Font("FreightSans Medium", 20, FontStyle.Regular);
string address = "Address goes here";
graphics.DrawString(address, new Font("FreightSans Medium", 20, FontStyle.Regular), b, new Point(621, 234));
graphics.DrawString("Employee Code:12345678", new Font("FreightSans Medium", 26, FontStyle.Regular), b, new Point(350, 407));
}
電流輸出被示出在圖像的左側。 這裏發生了什麼,我的字符串出箱。
我想在修正大小框中將其綁定。
示例顯示在圖像的右側。
使用此重載拉帶:http://msdn.microsoft.com/en-us/library/21kdfbzs.aspx – Rotem 2012-03-16 10:36:10