国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > C# > 正文

C#實現的滾動網頁截圖功能示例

2020-01-24 00:35:45
字體:
來源:轉載
供稿:網友

本文實例講述了C#實現的滾動網頁截圖功能。分享給大家供大家參考,具體如下:

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace WindowsFormsApplication1{  public partial class Form1 : Form  {    private int _currentWidth = 1024;    private Bitmap _currentBitmap = null;    public Form1()    {      InitializeComponent();    }private void button1_Click(object sender, EventArgs e){  if (webBrowser1.Document == null)    return;  try  {    int width = _currentWidth;    int height = webBrowser1.Document.Body.ScrollRectangle.Height;    webBrowser1.Width = width;    webBrowser1.Height = height;    _currentBitmap = new Bitmap(width, height);    webBrowser1.Stop();    webBrowser1.DrawToBitmap(_currentBitmap, new Rectangle(0, 0, width, height));    pictureBox1.Image = _currentBitmap;  }  catch (Exception ex)  {    MessageBox.Show(ex.ToString(), "遇到錯誤", MessageBoxButtons.OK, MessageBoxIcon.Error);  }}  }}

更多關于C#相關內容感興趣的讀者可查看本站專題:《C#圖片操作技巧匯總》、《C#常見控件用法教程》、《WinForm控件用法總結》、《C#數據結構與算法教程》、《C#面向對象程序設計入門教程》及《C#程序設計之線程使用技巧總結

希望本文所述對大家C#程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 海原县| 南开区| 洞头县| 缙云县| 靖宇县| 谢通门县| 南岸区| 星座| 泽普县| 闽侯县| 绵竹市| 淳化县| 普陀区| 遂昌县| 同心县| 延安市| 兴国县| 乐都县| 克山县| 山东省| 禹州市| 明溪县| 庆城县| 临泉县| 白河县| 唐海县| 弋阳县| 淮北市| 克拉玛依市| 大港区| 苏尼特左旗| 河西区| 曲松县| 甘德县| 宁明县| 巴东县| 扎赉特旗| 芒康县| 三门县| 保康县| 嘉黎县|