1
Reply

Mini image from webbrowser control

Ask a question
Ok, playing around with a small project in C# were I have a tabed control and each tab has it's own web browser control in it. The idea is to be able to switch between different web pages. The thing is that on one of the pages (located in the first tab) is constantly updating so I need a way to see what is going on even if I am in an other tab. 

So I thought I would make a small image of the site that is displayed on the right side of the form. It works just like the live images you see of a web browser in the windows task bar when you hoover it's icon with the mouse.

What I did was that I added a timer control and in it's tick event I added the following:

            Bitmap bm = new Bitmap(webBrowser1.ClientRectangle.Width,webBrowser1.ClientRectangle.Height);
            Graphics gr = Graphics.FromImage(bm);
            gr.CopyFromScreen(webBrowser1.PointToScreen(new Point(0,0)), new Point(0,0), new Size(webBrowser1.Width,webBrowser1.Height));

            pictureBox1.Image = bm;

Works great but as I point out only the points from were to read the image I will always show the image of the web browser that is in the active tab and not the one in the first tab.

How do I work around this?

Answers (1)