在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
//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("文字打印成功!"); } |
请发表评论