Resolved Screenshot location?

Jamie2993

Member
Joined
May 13, 2009
Messages
11
Programming Experience
1-3
Hi All,

Im trying to make my little project take a screenshot(which ive done).

But i cant seem to get a location set, my code:
VB.NET:
        Dim ScreenSize As Size = New Size(Form1.WebBrowser1.Width, Form1.WebBrowser1.Height)
        Dim screenGrab As New Bitmap(Form1.WebBrowser1.Width, Form1.WebBrowser1.Height)
        Dim g As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(screenGrab)
        g.CopyFromScreen(New Point(Form1.WebBrowser1.Location.X, Form1.WebBrowser1.Location.Y), New Point(Form1.WebBrowser1.Location.X, Form1.WebBrowser1.Location.Y), ScreenSize)
        screenGrab.Save("C:\" & TextBox1.Text & ".bmp")
        PictureBox2.Image = screenGrab

Thats what ive tried,

Im simply trying to get it to take a picture of webbrowser1 on form1.

Any Idea's how.

**WARNING** MAY NOT CHECK TILL LATER (WORK) **END OF**

Thanks In Advance,

Jamie.
 
Last edited:
VB.NET:
Dim p As Point = WebBrowser1.Parent.PointToScreen(WebBrowser1.Location)
g.CopyFromScreen(p, Point.Empty, ScreenSize)
 
Use the SaveFileDialog component, it's in Toolbox.
 
FULL Screenshot

Hi,

Thanks all worked great,

Trouble is on my project theres a panel u can hide and show.
So when they close it, it still only takes a picture the size of the webbrowser of when the panel was showing.

Anyway of making it "refresh" so it gets updated sizes of the webbrowser?


Thanks In Advance,
Jamie.
 

Latest posts

Back
Top