我制作了一个使用以下代码捕获屏幕的小应用程序:
Bitmap b = new Bitmap(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
Graphics g = Graphics.FromImage(b);
g.CopyFromScreen(Point.Empty,Point.Empty,Screen.PrimaryScreen.WorkingArea.Size);
现在我想将屏幕截图附加到邮件中。我已经编写了发送邮件的必要代码,我想要的只是附加图像。这是我用于邮件的代码:
MailMessage message = new MailMessage();
message.From = new MailAddress("mail_address@gmail.com");
message.Subject = "Subject";
message.Body = "Body";
message.To.Add("mail_address@gmail.com");
SmtpClient client = new SmtpClient();
client.Credentials = new NetworkCredential("mail_address@gmail.com", "password");
client.Host = "smtp.gmail.com";
client.Port = 587;
client.EnableSsl = true;
client.Send(message);
你能帮我解决这个问题吗?谢谢你。