这是用于印刷屏幕,
using System.Drawing;
using System.Drawing.Imaging;
Bitmap printscreen = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
Graphics graphics = Graphics.FromImage(printscreen as Image);
graphics.CopyFromScreen(0, 0, 0, 0, printscreen.Size);
printscreen.Save(@"filepath", ImageFormat.Jpeg);
我尝试将其放入我的控制器中,但它无法将 Screen 识别为任何东西。
这是为了连接,
System.Net.Mail.Attachment attachment;
attachment = new System.Net.Mail.Attachment("you attachment file");
mMailMessage.Attachments.Add(attachment);
我可以像这样添加文件路径吗?: new System.Net.Mail.Attachment("filepath");