资源简介

网页截图 C# .NET 整页截图 本人参考网络资源独立开发 测试正常

资源截图

代码片段和文件信息

using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Windows.Forms;


namespace webpage_capture_screenshot
{
    public class GetImage
    {
        private int S_Height;
        private int S_Width;
        private int F_Height;
        private int F_Width;
        private string wb;

        public int ScreenHeight
        {
            get { return S_Height; }
            set { S_Height = value; }
        }

        public int ScreenWidth
        {
            get { return S_Width; }
            set { S_Width = value; }
        }

        public int ImageHeight
        {
            get { return F_Height; }
            set { F_Height = value; }
        }

        public int ImageWidth
        {
            get { return F_Width; }
            set { F_Width = value; }
        }

        public string WebSite
        {
            get { return wb; }
            set { wb = value; }
        }

        public GetImage(string webSite int ScreenWidth int ScreenHeight int ImageWidth int ImageHeight)
        {
            this.wb = webSite;
            this.ScreenWidth = ScreenWidth;
            this.ScreenHeight = ScreenHeight;
            this.ImageHeight = ImageHeight;
            this.ImageWidth = ImageWidth;
        }

        public Bitmap GetBitmap()
        {
            WebPageBitmap Shot = new WebPageBitmap(this.WebSite this.ScreenWidth this.ScreenHeight);
            Shot.GetIt();
            Bitmap Pic = Shot.DrawBitmap(this.ImageHeight this.ImageWidth);
            return Pic;
        }
    }

    class WebPageBitmap
    {
        WebBrowser MyBrowser;
        string URL;
        int Height;
        int Width;

        public WebPageBitmap(string url int width int height)
        {
            this.Height = height;
            this.Width = width;
            this.URL = url;
            MyBrowser = new WebBrowser();
            MyBrowser.ScrollBarsEnabled = false;
            MyBrowser.Size = new Size(this.Width this.Height);
        }

        public void GetIt()
        {
            MyBrowser.Navigate(this.URL);
            CheckHTML ck = new CheckHTML();
            int ret = -1;

            //do
            //{
                if (-1 != ret) MyBrowser.Navigate(this.URL);
                while (MyBrowser.ReadyState != WebBrowserReadyState.Complete)
                {
                    Application.DoEvents();
                }

                ck.GetEncodeHtml(MyBrowser.DocumentStream);
                ret = ck.AnalyzeDocType();
            //} while (0 != ret);


            this.Height = int.Parse(MyBrowser.Document.Body.GetAttribute(“scrollHeight“));
            this.Width = int.Parse(MyBrowser.Document.Body.GetAttribute(“scrollwidth“));
            //MyBrowser.Size = new Size(this.Width this.Height); 
        }

        public Bitmap DrawBitmap(int theight int

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2011-12-10 22:38  webpage_capture_screenshot\bin\
     目录           0  2011-12-10 11:44  webpage_capture_screenshot\bin\Release\
     文件       32768  2011-12-10 19:58  webpage_capture_screenshot\bin\Release\webpage_capture_screenshot.exe
     文件       52736  2011-12-10 19:58  webpage_capture_screenshot\bin\Release\webpage_capture_screenshot.pdb
     文件        5632  2005-09-23 06:56  webpage_capture_screenshot\bin\Release\webpage_capture_screenshot.vshost.exe
     文件        4143  2011-12-10 08:29  webpage_capture_screenshot\Class1.cs
     文件        1542  2011-12-09 22:51  webpage_capture_screenshot\Class2.cs
     文件        5352  2011-12-10 09:00  webpage_capture_screenshot\Class3.cs
     文件        9268  2011-12-10 19:56  webpage_capture_screenshot\Class4.cs
     文件        7935  2011-12-10 19:58  webpage_capture_screenshot\Form1.cs
     文件        5625  2011-12-10 19:58  webpage_capture_screenshot\Form1.Designer.cs
     文件        5814  2011-12-10 19:58  webpage_capture_screenshot\Form1.resx
     目录           0  2011-12-10 11:44  webpage_capture_screenshot\obj\
     目录           0  2011-12-10 11:43  webpage_capture_screenshot\obj\Debug\
     目录           0  2011-12-08 00:39  webpage_capture_screenshot\obj\Debug\Refactor\
     目录           0  2011-12-07 23:53  webpage_capture_screenshot\obj\Debug\TempPE\
     文件         842  2011-12-10 11:43  webpage_capture_screenshot\obj\Debug\webpage_capture_screenshot.csproj.GenerateResource.Cache
     文件       28672  2011-12-10 11:43  webpage_capture_screenshot\obj\Debug\webpage_capture_screenshot.exe
     文件         180  2011-12-10 11:43  webpage_capture_screenshot\obj\Debug\webpage_capture_screenshot.Form1.resources
     文件       42496  2011-12-10 11:43  webpage_capture_screenshot\obj\Debug\webpage_capture_screenshot.pdb
     文件         180  2011-12-08 00:00  webpage_capture_screenshot\obj\Debug\webpage_capture_screenshot.Properties.Resources.resources
     目录           0  2011-12-10 19:58  webpage_capture_screenshot\obj\Release\
     文件        2021  2011-12-10 11:49  webpage_capture_screenshot\obj\Release\ResolveAssemblyReference.cache
     目录           0  2011-12-10 11:44  webpage_capture_screenshot\obj\Release\TempPE\
     文件         842  2011-12-10 19:58  webpage_capture_screenshot\obj\Release\webpage_capture_screenshot.csproj.GenerateResource.Cache
     文件       32768  2011-12-10 19:58  webpage_capture_screenshot\obj\Release\webpage_capture_screenshot.exe
     文件         180  2011-12-10 19:58  webpage_capture_screenshot\obj\Release\webpage_capture_screenshot.Form1.resources
     文件       52736  2011-12-10 19:58  webpage_capture_screenshot\obj\Release\webpage_capture_screenshot.pdb
     文件         180  2011-12-10 11:44  webpage_capture_screenshot\obj\Release\webpage_capture_screenshot.Properties.Resources.resources
     文件        1570  2011-12-10 20:24  webpage_capture_screenshot\obj\webpage_capture_screenshot.csproj.FileListAbsolute.txt
     文件         493  2011-12-07 23:53  webpage_capture_screenshot\Program.cs
............此处省略10个文件信息

评论

共有 条评论