分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

        /// <summary>        /// Capture IE full document.        /// </summary>        /// <param name="ieParams"> IE parameters. </param>        /// <param name="savePath"> Save path. </param>        /// <returns> Returns false if failed. </returns>        internal static bool CaptureFullIEDocument(IEParams ieParams, string savePath)        {            try            {                IHTMLElement body = null;                if (IEHelper.IsDtdDocument(ieParams.WebObj.Document) != false)                {                    // For doc3 standard.                    IHTMLDocument3 doc = (IHTMLDocument3)ieParams.WebObj.Document;                    body = doc.documentElement;                }                else                {                    // For doc2 standard                    IHTMLDocument2 doc = (IHTMLDocument2)ieParams.WebObj.Document;                    body = doc.body.parentElement;                    if ((int)body.getAttribute("clientHeight") == 0)                    {                        body = doc.body;                    }                }                body.setAttribute("scroll", "yes", 0);                // Get Browser Window(web) Height and Width.                int webHeight = (int)body.getAttribute("scrollHeight");                int webWidth = (int)body.getAttribute("scrollWidth");                // Get client's screen height and width, in pixels.                int screenHeight = (int)body.getAttribute("clientHeight");                int screenWidth = (int)body.getAttribute("clientWidth");                // Set bitmaps to hold screen fragment.                Bitmap screenFragment = new Bitmap(screenWidth, screenHeight, PixelFormat.Format16bppRgb555);                // Target bitmap to draw into.                Bitmap targetBitmap = new Bitmap(webWidth, webHeight, PixelFormat.Format16bppRgb555);                Graphics gTarget = Graphics.FromImage(targetBitmap);                Graphics g = null;                // How many "pages" in this web.                int page = 0;                // Get the screen height (bottom up screen drawing).                while ((page * screenHeight) < webHeight)                {                    // - 5 -- for cutting the edge in IE6 when capture the screen by scrolling.                    body.setAttribute("scrollTop", (screenHeight - Edge) * page, 0);                    ++page;                }                // Rollback the page count by one.                --page;                // How many times you need to scroll horizontally.                int pageWidthCount = 0;                while ((pageWidthCount * screenWidth) < webWidth)                {                    body.setAttribute("scrollLeft", (screenWidth - Edge) * pageWidthCount, 0);                    int scrollLeft = (int)body.getAttribute("scrollLeft");                    // Loop through every pages.                    for (int i = page; i >= 0; --i)                    {                        // Shoot visible window.                        g = Graphics.FromImage(screenFragment);                        // Get handleof the device context.                        IntPtr hdc = g.GetHdc();                        body.setAttribute("scrollTop", (screenHeight - Edge) * i, 0);                        int scrollTop = (int)body.getAttribute("scrollTop");                        // Copy a visual window into the specified device context(DC).                        // hwnd - Handle to the window that will be copied.                        // hdc - Handle to the device context.                        // 0 - specifies the drawing options.                        PrintWindow(ieParams.HCurPage, hdc, 0);                        g.ReleaseHdc(hdc);                        g.Flush();                        Image fragment = Image.FromHbitmap(screenFragment.GetHbitmap());                        try                        {                            gTarget.DrawImage(fragment, scrollLeft, scrollTop);                        }                        catch (ArgumentNullException ex)                        {                            MessageBox.Show("Error occurred in DrawImage: " + ex);                        }                    }                    ++pageWidthCount;                }                const double Resolution = 100 * 0.01; // Set the resulution to 1:1.                int finalWidth = (int)(webWidth * Resolution);                int finalHeight = (int)(webHeight * Resolution);                Bitmap finalImage = new Bitmap(finalWidth, finalHeight, PixelFormat.Format16bppRgb555);                Graphics finalGraphic = Graphics.FromImage(finalImage);                // Draw the final image.                try                {                    finalGraphic.DrawImage(targetBitmap, 0, 0, finalWidth, finalHeight);                }                catch (ArgumentNullException ex)                {                    MessageBox.Show("Error occurred in drawing final Image: " + ex);                }                ImageHelper imageHelper = new ImageHelper(savePath);                finalImage.Save(savePath, imageHelper.ImageCodecInfo, imageHelper.EncoderParameters);                // clean up                body = null;                g.Dispose();                gTarget.Dispose();                finalGraphic.Dispose();                screenFragment.Dispose();                targetBitmap.Dispose();                finalImage.Dispose();            }            catch (Exception ex)            {                throw new Exception(string.Format("Capture operation failed in the CaptureFullIEDocument function. The error message is: \n{0}", ex.Message), ex);            }            // Return true when success.            return true;        }

给我老师的人工智能教程打call!http://blog.csdn.net/jiangjunshow

C Capture Full IE Document相关推荐

  1. Javascript 的addEventListener()及attachEvent()区别分析

    Mozilla中: addEventListener的使用方式: target.addEventListener(type, listener, useCapture); target: 文档节点.d ...

  2. addEventListener 的用法示例介绍

    (要注意的是div必须放到js前面才行) 一般情况下,如果给一个dom对象绑定同一个事件,只有最后一个会生效,比如: 复制代码 代码如下: document.getElementById(" ...

  3. Management of your data

    Management of your data 文章目录 Management of your data Intro Session data Data lifecycle Why Areas of ...

  4. vue滚动条禁止_vue弹窗后如何禁止滚动条滚动?

    常见场景 在许多填写表单的页面中,都会弹出一个选择器,让你在弹窗中选择项目.有时,弹窗本身容纳不下内容,需要让它不断滚动来展示,但因为事件是冒泡的,有时就会造成底部(body 的Z-index肯定是在 ...

  5. c# contains方法_HTML5系列之新的API(新操作方法、文件获取、地理定位、音视频、摄像头等)

    HTM5中的API 新的操作方法 1.获取元素的方法 获取单个元素,参数可以是我们任意的选择器. document.querySelect('选择器'); 获取多个元素,参数是任意的选择器 docum ...

  6. WEB前端常用JavaScript代码整理(二)

    对象的判空 将json对象转化成json字符串,然后进行判断是否等于字符串'{}',直接写{}无法进行判断 let isObject = {}; console.log(JSON.stringify( ...

  7. JavaScript常用DOM操作方法和函数

    查找节点 ocument.querySelector(selectors) //接受一个CSS选择器作为参数,返回第一个匹配该选择器的元素节点. document.querySelectorAll(s ...

  8. C#基于RealPlayX.ocx视频监控整合程序

    软件是基于C#语言进行开发的,运行在.net framework4.0以上的环境中.在每台查看视频监控的机器中借助于"RealPlayX.ocx"技术在网页中运行视频画面. 系统使 ...

  9. vue 调色器和js-web-screen-shot截图插件

    最近在做 Cesium 需要的功能模块,然后写了个demo,发现demo里的模块功能泛用性很高所以写个文章记录一下先.PS:很少有人提到,这个调用了网络摄像头拍照如果在localhost下没有问题的, ...

最新文章

  1. [BZOJ2938]:[Poi2000]病毒
  2. 桌面计算机怎么覆盖文件,win7系统桌面快捷方式图标被未知文件覆盖如何解决...
  3. 人工智能 | 人脸识别研究报告(人才篇)
  4. python2使用openpyxl_使用openpyxl for Python2.6有些困难
  5. ibator1.2.2
  6. JDBC连接池和DBUtils
  7. php dm,DM_cp.php
  8. 阿里文娱实战 | 小而美的 egg-react-ssr 开源实现方案
  9. python朴素贝叶斯分类的手写数字识别_关于利用机器学习进行手写数字的的识别...
  10. 【水管规格】4分管、6分管水管的直径,丝口螺纹,铝塑管接头
  11. VC6.0 操作Excel表格
  12. 云计算对21世纪IT人的挑战
  13. 【大数据】Linkis如何安装部署,及一些常见问题
  14. Flink CheckpointCoordinator 步骤 流程 源码
  15. VC 模拟鼠标和键盘输入
  16. 如何高效提高倾斜摄影三维模型顶层合并的技术方法分析
  17. mysql创建前缀索引
  18. java 基础练习(1-5)
  19. 学会Nginx优化与防盗链预防坏蜀黍
  20. 面料防静电测试方法指南

热门文章

  1. wxruby框架例子1
  2. 为什么白帽SEO更好?
  3. id和class到底要用哪一个?
  4. 初步理解TCP/IP网络
  5. 53. Maximum Subarray
  6. 在ISA Server 2004中发布×××服务器
  7. 内部人看FaceBook
  8. 基于协程的并发框架orchid简介
  9. docker inspect 获取 容器 镜像 元数据 简介
  10. golang struct 动态创建