Go Back   CodeCall Programming Forum > Software Development > Tutorials > VB Tutorials
Register Blogs Search Today's Posts Mark Forums Read

VB Tutorials Visual Basic Tutorials and Code

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-07-2009, 04:02 AM
VBnet's Avatar
Newbie
 
Join Date: May 2009
Location: Sweden :D
Posts: 18
VBnet is on a distinguished road
Send a message via MSN to VBnet
Screen Shot

Hello CodeCall Members!!

I will be showing you how to take a screen shot with VB.NET

First youŽll need 2 Buttons and a picture box wich covers a big area

place the first button and rename it to "Take Screenshot", then add the code :
Code:
Dim bounds As Rectangle
        Dim screenshot As System.Drawing.Bitmap
        Dim graph As Graphics
        bounds = Screen.PrimaryScreen.Bounds
        screenshot = New System.Drawing.Bitmap(bounds.Width, bounds.Height, 

System.Drawing.Imaging.PixelFormat.Format32bppArgb)
        graph = Graphics.FromImage(screenshot)
        graph.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy)
        PictureBox1.Image = screenshot
then place the second button, name it "Save", then add the code :
Code:
Dim savefiledialog1 As New SaveFileDialog
        Try
            savefiledialog1.Title = "Save File"
            savefiledialog1.FileName = "*.jpeg"
            savefiledialog1.Filter = "JPEG |*.jpeg"
            If savefiledialog1.ShowDialog() = DialogResult.OK Then
                PictureBox1.Image.Save(savefiledialog1.FileName, System.Drawing.Imaging.ImageFormat.Bmp)
            End If
        Catch ex As Exception 'Do Nothing
        End Try
and at last add the picture box, make sure it covers a big area so that the screenshot will fit in.

Last edited by WingedPanther; 05-07-2009 at 06:58 AM..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-07-2009, 06:59 AM
WingedPanther's Avatar
Super Moderator
 
Join Date: Jul 2006
Age: 36
Posts: 11,435
WingedPanther has much to be proud ofWingedPanther has much to be proud ofWingedPanther has much to be proud ofWingedPanther has much to be proud ofWingedPanther has much to be proud ofWingedPanther has much to be proud ofWingedPanther has much to be proud ofWingedPanther has much to be proud ofWingedPanther has much to be proud of
Re: Screen Shot

Not bad, but PLEASE be sure to use the code tags (the # button) when posting code, especially in a tutorial.
__________________
CodeCall Blog | CodeCall Wiki | Shareware
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-07-2009, 12:34 PM
Xav's Avatar
Xav Xav is offline
Code Slinger
 
Join Date: Mar 2008
Location: The North Pole
Posts: 13,210
Xav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud of
Send a message via MSN to Xav
Re: Screen Shot

Look at these properties:

Code:
savefiledialog1.Title = "Save File"
            savefiledialog1.FileName = "*.jpeg"
            savefiledialog1.Filter = "JPEG |*.jpeg"
Why not simply add a dialog from the toolbox? It would save a lot of coding work.
__________________

Quote:
Originally Posted by Jordan View Post
Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 05-07-2009, 01:16 PM
VBnet's Avatar
Newbie
 
Join Date: May 2009
Location: Sweden :D
Posts: 18
VBnet is on a distinguished road
Send a message via MSN to VBnet
Smile Re: Screen Shot

Quote:
Originally Posted by Xav View Post
Look at these properties:

Code:
savefiledialog1.Title = "Save File"
            savefiledialog1.FileName = "*.jpeg"
            savefiledialog1.Filter = "JPEG |*.jpeg"
Why not simply add a dialog from the toolbox? It would save a lot of coding work.
hmm. dunno why.. i dont mind doing some code work.. :001_tt2:
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 05-07-2009, 01:18 PM
Xav's Avatar
Xav Xav is offline
Code Slinger
 
Join Date: Mar 2008
Location: The North Pole
Posts: 13,210
Xav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud of
Send a message via MSN to Xav
Re: Screen Shot

Lol - but if it's easier, then why not?
__________________

Quote:
Originally Posted by Jordan View Post
Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 05-07-2009, 02:32 PM
VBnet's Avatar
Newbie
 
Join Date: May 2009
Location: Sweden :D
Posts: 18
VBnet is on a distinguished road
Send a message via MSN to VBnet
Re: Screen Shot

Quote:
Originally Posted by Xav View Post
Lol - but if it's easier, then why not?
because i dont mind typing 3 lines of coding
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 05-07-2009, 02:39 PM
Xav's Avatar
Xav Xav is offline
Code Slinger
 
Join Date: Mar 2008
Location: The North Pole
Posts: 13,210
Xav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud ofXav has much to be proud of
Send a message via MSN to Xav
Re: Screen Shot

I thought you like to keep tutorials simple?

+rep for the tutorial.
__________________

Quote:
Originally Posted by Jordan View Post
Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 05-08-2009, 09:19 AM
VBnet's Avatar
Newbie
 
Join Date: May 2009
Location: Sweden :D
Posts: 18
VBnet is on a distinguished road
Send a message via MSN to VBnet
Re: Screen Shot

Quote:
Originally Posted by Xav View Post
I thought you like to keep tutorials simple?

+rep for the tutorial.
Yeah i do
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Tutorial] Hackers Gibson, Desktop Customization Donovan Tutorials 21 07-25-2009 01:20 PM
C++ and SDL Game oogie C and C++ 3 04-17-2009 05:24 PM
Need help inmediatly -hetsteve- Java Help 5 01-01-2009 07:33 AM
Pup Inc's Arrow Over Lay Screen Shot Browers Explained Kernel News 0 08-25-2007 11:16 PM
capture screen shot from an application during run time engr Visual Basic Programming 1 01-29-2007 04:38 PM


All times are GMT -5. The time now is 09:48 AM.


vBulletin v3.8.0 ©2010, Jelsoft Enterprises Ltd.


no new posts

LinkBacks Enabled by vBSEO 3.1.0