图片印字(C#)
//img.Text为存放着图片路径的TextBox
//word.Text为存放要在图片上打印的文字的TextBox
private void button9_Click(object sender, System.EventArgs e)
{
Bitmap sourceImg=new Bitmap(@img.Text);
Graphics g=Graphics.FromImage((Image)sourceImg);
//SolidBrush brush=new SolidBrush(Color.Red);
Font drawFont = new Font("Arial", 20, FontStyle.Regular, GraphicsUnit.Point);
int xPos =25;
int yPos = 3;
string savePath=img.Text.Substring(0,img.Text.Length-4)+"XX.jpg";
g.DrawString (word.Text, drawFont, Brushes.Blue, xPos, yPos);
sourceImg.Save(@savePath,System.Drawing.Imaging.ImageFormat.Jpeg);
sourceImg=null;
MessageBox.Show("文字打印成功!");
}
-----------------------------------------------------------------