screen shot of a web browser control - c#

In some development cases you might need to get a screen shot of a web browser control and save the screen shot as a image. You have to keep the code inside webBrowser1_DocumentCompleted

using (var pic = new Bitmap(webBrowser1.Width, webBrowser1.Height))
            {
                webBrowser1.DrawToBitmap(pic, new Rectangle(0, 0, pic.Width, pic.Height));
                pic.Save("C:\\Users\\Dasun1\\Desktop\\Untitled121212.png");
            }

Comments

Popular Posts