如何用c# 在web asp.net里实现截图?
wen在本地单击按钮可以截图保存,但是发布在iis上面就报错g.CopyFromScreen(0,0,0,0,_Source.Size);找不到句柄这个应该如何解决呢?难...
wen 在本地单击按钮可以截图保存,但是发布在iis上面就报错g.CopyFromScreen(0, 0, 0, 0, _Source.Size);找不到句柄这个应该如何解决呢?难道CopyFromScreen真的只能在winform里用不能在web里面用么,那么web截图该如何做呢,请高手帮忙。
protected void btnClik_Click(object sender, EventArgs e)
{
Bitmap _Source = new Bitmap(GetSystemMetrics(0), GetSystemMetrics(1));
using (Graphics g = Graphics.FromImage(_Source))
{
g.CopyFromScreen(0, 0, 0, 0, _Source.Size);
g.Dispose();
_Source.Save(Server.MapPath("/Upload/" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".jpg"));
}
image.ImageUrl = "/Upload/" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".jpg";
} 展开
protected void btnClik_Click(object sender, EventArgs e)
{
Bitmap _Source = new Bitmap(GetSystemMetrics(0), GetSystemMetrics(1));
using (Graphics g = Graphics.FromImage(_Source))
{
g.CopyFromScreen(0, 0, 0, 0, _Source.Size);
g.Dispose();
_Source.Save(Server.MapPath("/Upload/" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".jpg"));
}
image.ImageUrl = "/Upload/" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".jpg";
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询