C#實(shí)現(xiàn)的滾動(dòng)網(wǎng)頁(yè)截圖功能示例
本文實(shí)例講述了C#實(shí)現(xiàn)的滾動(dòng)網(wǎng)頁(yè)截圖功能。分享給大家供大家參考,具體如下:
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(), "遇到錯(cuò)誤", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
更多關(guān)于C#相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《C#圖片操作技巧匯總》、《C#常見控件用法教程》、《WinForm控件用法總結(jié)》、《C#數(shù)據(jù)結(jié)構(gòu)與算法教程》、《C#面向?qū)ο蟪绦蛟O(shè)計(jì)入門教程》及《C#程序設(shè)計(jì)之線程使用技巧總結(jié)》
希望本文所述對(duì)大家C#程序設(shè)計(jì)有所幫助。
相關(guān)文章
C# 實(shí)現(xiàn)dataGridView選中一行右鍵出現(xiàn)菜單的示例代碼
這篇文章主要介紹了C# 實(shí)現(xiàn)dataGridView選中一行右鍵出現(xiàn)菜單,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-09-09C#編程自學(xué)之?dāng)?shù)據(jù)類型和變量一
本節(jié)課我們將學(xué)習(xí)C#編程語言的數(shù)據(jù)類型,數(shù)據(jù)類型可以分為值類型和引用類型,接著介紹變量的使用方法和作用域等內(nèi)容,為了方便大家理解,我們還會(huì)舉一些小例子作為說明。2015-10-10c# winform異步不卡界面的實(shí)現(xiàn)方法
這篇文章主要給大家介紹了關(guān)于c# winform異步不卡界面的實(shí)現(xiàn)方法,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用c#具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧2019-07-07C#使用Selenium+PhantomJS抓取數(shù)據(jù)
本文主要介紹了C#使用Selenium+PhantomJS抓取數(shù)據(jù)的方法步驟,具有很好的參考價(jià)值,下面跟著小編一起來看下吧2017-02-02C#執(zhí)行存儲(chǔ)過程并將結(jié)果填充到GridView的方法
這篇文章主要介紹了C#執(zhí)行存儲(chǔ)過程并將結(jié)果填充到GridView的方法,結(jié)合實(shí)例形式分析了C#存儲(chǔ)過程操作及GridView控件相關(guān)操作技巧,需要的朋友可以參考下2017-02-02C#判斷一個(gè)類是否實(shí)現(xiàn)了某個(gè)接口3種實(shí)現(xiàn)方法
這篇文章主要介紹了C#判斷一個(gè)類是否實(shí)現(xiàn)了某個(gè)接口3種實(shí)現(xiàn)方法,本文直接給出實(shí)現(xiàn)代碼,需要的朋友可以參考下2015-06-06