图像保存在网页浏览器中显示 [英] Saving image shown in web browser

查看:130
本文介绍了图像保存在网页浏览器中显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对不起,我英文不好。

我如何可以将图像保存的一个在我的浏览器,而不重新下载图像?像IE'保存

How can I save one of the images in my web Browser without redownload that image? Like ie 'Save

图片设置为选项?浏览器有图片另存为上下文菜单,但我想保存图片

picture as' option? The browser has 'save picture as' in context menu but I want to save image

在不使用此选项,并希望自动保存。谢谢你。

without using this option and want to save automatically. Thanks.

推荐答案

来源这里的在这里

IHTMLDocument2 doc = (IHTMLDocument2) webBrowser1.Document.DomDocument;
IHTMLControlRange imgRange = (IHTMLControlRange) ((HTMLBody) doc.body).createControlRange();

foreach (IHTMLImgElement img in doc.images)
{
     imgRange.add((IHTMLControlElement) img);

     imgRange.execCommand("Copy", false, null);

     using (Bitmap bmp = (Bitmap) Clipboard.GetDataObject().GetData(DataFormats.Bitmap))
     {
         bmp.Save(@"C:\"+img.nameProp);
     }
}

这篇关于图像保存在网页浏览器中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆