从品牌网站建设到网络营销策划,从策略到执行的一站式服务
使用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); } } } }
看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注创新互联行业资讯频道,感谢您对创新互联的支持。
成都网站建设公司地址:成都市青羊区太升南路288号锦天国际A座10层 建设咨询028-86922220
成都快上网科技有限公司-四川网站建设设计公司 | 蜀ICP备19037934号 Copyright 2020,ALL Rights Reserved cdkjz.cn | 成都网站建设 | © Copyright 2020版权所有.
专家团队为您提供成都网站建设,成都网站设计,成都品牌网站设计,成都营销型网站制作等服务,成都建网站就找快上网! | 成都网站建设哪家好? | 网站建设地图