捕捉图像的WebBrowser [英] Capture WebBrowser Image

查看:157
本文介绍了捕捉图像的WebBrowser的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此代码saveFileDialog节省

This code return a white image after saving with saveFileDialog

private void salvaUnImmagineToolStripMenuItem_Click(object sender, EventArgs e)
            {                    
                if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    SaveAsBitmap(webBrowser1, saveFileDialog1.FileName);
                }                
            }

            public void SaveAsBitmap(Control control, string fileName)
            {
                //getthe instance of the graphics from the control
                Graphics g = control.CreateGraphics();

                //new bitmap object to save the image
                Bitmap bmp = new Bitmap(control.Width, control.Height);

                //Drawing control to the bitmap
                control.DrawToBitmap(bmp, new Rectangle(0, 0, control.Width, control.Height));

                bmp.Save(fileName);
                bmp.Dispose();
            }



我如何能捕捉Web浏览器的一个形象?

How I can capture a image of web browser?

推荐答案

看这里显示的 http://pietschsoft.com/post/2008/07/C-Generate-WebPage-Thumbmail-Screenshot-Image.aspx

这篇关于捕捉图像的WebBrowser的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆