It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming Visual Basic Forum

Copy screenshot into PictureBox

Moderator: dafunkymunky

Copy screenshot into PictureBox

Postby perro on Thu Aug 28, 2008 11:49 am

How to print screen and import it into PictureBox?

Private Sub Print_Click...
SendKeys.Send("^{PRTSC}")
System.Threading.Thread.Sleep(200)
PictureBox.Image = Clipboard.GetImage()
PictureBox.Refresh()
End Sub

First time I click the button nothing appears. Second time I push the button screenshot of screen appears like it was first time I pushed the button, and so on...
If I divide my code into 2 parts, and push 2 buttons one after another everything works fine. What to do?
perro
 
Posts: 3
Joined: Thu Aug 28, 2008 9:43 am

Postby chubzyko on Thu Aug 28, 2008 5:43 pm

haiya perro! i just created this print screen capture! if you click the capture button, it will capture the entire screen. and there's also a save button wherein it will be save in your c: as a jpg file. btw, there's a picturebox in the form but i made the visible to false. but you can edit it if you want the picture box to be visible.


here's the link where you can download it.

http://ijustdontcare.net76.net/
"Failure is the key to success, so try and try until you succeed."
User avatar
chubzyko
100+ Club
 
Posts: 104
Joined: Wed Jul 30, 2008 10:48 pm
Location: Marikina City, Philippines

Postby chubzyko on Thu Aug 28, 2008 5:44 pm

just download the capture.zip file. and plz dont try to see my other personal files there.
"Failure is the key to success, so try and try until you succeed."
User avatar
chubzyko
100+ Club
 
Posts: 104
Joined: Wed Jul 30, 2008 10:48 pm
Location: Marikina City, Philippines

Postby perro on Fri Aug 29, 2008 11:28 am

I've downloaded it, thanks.

First I tried with VB6.0, and got it, but application didn't work on PC with only VB6Runtime. Therefore I tried with VB .NET. But I still can't figure out why this works with two buttons, and with one...
perro
 
Posts: 3
Joined: Thu Aug 28, 2008 9:43 am

Postby chubzyko on Fri Aug 29, 2008 3:46 pm

hmn? what do you mean?
"Failure is the key to success, so try and try until you succeed."
User avatar
chubzyko
100+ Club
 
Posts: 104
Joined: Wed Jul 30, 2008 10:48 pm
Location: Marikina City, Philippines

Postby perro on Fri Sep 05, 2008 1:22 pm

Never mind... Handled it...
Problem was that SendKeys instruction sends PRTSC only after event has finished. Therefore, copying clipboard into picturebox allways handled screen shot which was taken the last time the event was activated.
perro
 
Posts: 3
Joined: Thu Aug 28, 2008 9:43 am


Who is online

Users browsing this forum: No registered users and 4 guests