|ZYCIIS| 如何让WebBrowser不显示和不下载jpg gif png的文件呢? 谢谢

javamy010 2012-12-08 11:42:11
我要用WebBrowser去浏览网站,
因为速度要求,
要求不要去下载图片资源
那WebBrowser应该如何来实现
谢谢

PS:是不下载图片资源,并不是说在WebBrowser中显示后把图片标签去掉

谢谢
...全文
296 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
javamy010 2012-12-11
  • 打赏
  • 举报
回复
引用 5 楼 findcaiyzh 的回复:
Controlling Download and Execution The WebBrowser Control gives you control over what it downloads, displays, and executes. To gain this control, you need to implement your host's IDispatch so it h……
C++的东西还是看不懂啊。。。
javamy010 2012-12-10
  • 打赏
  • 举报
回复


        private void wbSite_Navigating(object sender, WebBrowserNavigatingEventArgs e)
        {
            if (this.wbSite.Document != null)
            {
                var doc = this.wbSite.Document;
                if (doc != null)
                {
                    var imgs = doc.GetElementsByTagName("img");
                    //"edit_parent"
                    foreach (HtmlElement img in imgs)
                    {
                            Console.WriteLine(img.InnerHtml);
                            img.SetAttribute("src", "");
                            img.SetAttribute("alt", "去除");
                    }
                    var links = doc.GetElementsByTagName("link");
                    foreach (HtmlElement link in links)
                    {
                        Console.WriteLine(link.InnerHtml);
                        link.SetAttribute("href", "去除");
                    }
                }
               
            }
我用上面的方法的话,还是会在页面加载的时候显示图片和样式 如何才能让WebBorswer不显示图片和CSS样式呢? PS:是在不去改IE设置的前题 谢谢
宝_爸 2012-12-10
  • 打赏
  • 举报
回复
Controlling Download and Execution The WebBrowser Control gives you control over what it downloads, displays, and executes. To gain this control, you need to implement your host's IDispatch so it handles DISPID_AMBIENT_DLCONTROL. When the WebBrowser Control is instantiated, it will call your IDispatch::Invoke with this ID. Set pvarResult to a combination of following flags, using the bitwise OR operator, to indicate your preferences. * DLCTL_DLIMAGES, DLCTL_VIDEOS, and DLCTL_BGSOUNDS: Images, videos, and background sounds will be downloaded from the server and displayed or played if these flags are set. They will not be downloaded and displayed if the flags are not set. 没试过,来自: WebBrowser Customization http://msdn.microsoft.com/en-us/library/aa770041(VS.85).aspx
nonocast 2012-12-10
  • 打赏
  • 举报
回复
一个比较dirty的方法,写NDIS驱动,或者利用Winpcap拦截mime是image/*的HTTP请求
threenewbee 2012-12-09
  • 打赏
  • 举报
回复
http://bbs.csdn.net/topics/200056000 http://msdn.microsoft.com/en-us/library/aa770041(VS.85).aspx 中的 Controlling Download and Execution
javamy010 2012-12-09
  • 打赏
  • 举报
回复


        private void wbSite_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            if (this.wbSite.Document != null)
            {
                var doc = this.wbSite.Document;
                if (doc != null)
                {
                    var imgs = doc.GetElementsByTagName("img");
                    //"edit_parent"
                    foreach (HtmlElement img in imgs)
                    {
                         img.SetAttribute("src", "");
                    }

                }
                return;
            }
        }
我用这种方法,只是是网页加载后,再把图片去掉 如果在在加,但还没有加载资源的时候去掉 谢谢
源码下载地址: https://pan.quark.cn/s/40677b766bda "ContextCapture 倾斜摄影快速、创新及全面空三建模与单机集群硬件部署方案2018" 此资源聚焦于倾斜摄影(ContextCapture)空三建模及单机集群硬件部署方案,致力于为用户呈现最快、最优成本效益的台式工作站、移动工作站、并行集群的多样化部署选择。以下是该资源的详细知识点概述: 一、相关设备型号说明 * UltraLAB 是西安坤隆计算机科技有限公司推出的专属图形工作站品牌,具备三大卓越优势:顶尖的计算硬件架构、精准的行业应用定制服务、专业的硬件系统优化工艺。 二、硬件部署方案 * 台式工作站部署建议:设备特色在于当前市场上最快的台式计算架构,适用于办公场景下,部门层级常规的倾斜摄影空三处理、三维建模。 * 便携式工作站部署建议:设备特色在于当前市场上最快的移动计算架构,适用于移动倾斜摄影的空三处理、三维建模工作站。 * 大数据量处理工作站推荐:设备特色在于极限自动超频加速与16个并行存储构造,具备空三处理和三维建模最强的计算性能及海量高速并行存储性能。 * 多设备并行计算集群部署建议:针对海量图像数据计算产生的巨大需求,单机计算能力处理时间过长,效率不高,通过多台机器并行集群,进行空三处理、三维建模,显著减少处理时间。 三、部署方案深入解析 * 2.1 倾斜摄影建模(台式工作站)部署方案:设备特色在于最高的计算处理能力~6核5.2GHz,内存最大配置可达64GB,配备最新图灵架构的RTX显卡,相比市场其他品牌机器(单CPU、双Xeon处理器)更快、更具成本效益。 * 2.2 倾斜摄影建模(移动便携式工作站)硬件部署方案:设备特色在于最高的计算处理能力~6...

111,129

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧