1

这是用于印刷屏幕,

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");

4

1 回答 1

2

这是一个 Windows 代码,可以在 WinForm 上而不是在客户端浏览器上运行。

于 2011-10-02T15:40:46.327 回答