图片印字(C#)

it2022-05-09  32

//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("文字打印成功!");   }

转载于:https://www.cnblogs.com/tuyile006/archive/2006/08/01/464831.html

相关资源:数据结构—成绩单生成器

最新回复(0)