Click here to Skip to main content
12,888,493 members (52,834 online)
Click here to Skip to main content
Add your own
alternative version


58 bookmarked
Posted 21 Jul 2008

Screen Capture Class

, 5 Aug 2008 CPOL
Rate this:
Please Sign up or sign in to vote.
The SCapture class allows an application to capture still screen images


The SCapture class allows an application to capture a still screen image. It also provides a functionality to include the cursor in the image.

Class Shared Methods

  • FullScreen - Captures the full screen (all monitors in a single image)
  • DisplayMonitor - Captures a display monitor
  • ActiveWindow - Captures the active window
  • Window - Captures a window specified by the handle (overloaded)
  • Control - Captures a control of a window specified by a handle or a point (overloaded)
  • ScreenRectangle - Captures a rectangle image from the screen


The class differs from some other similar articles that provide classes to capture an image from the screen by giving the application ability to capture transparent Windows images. The core of the class is based on some API methods.

Click to enlarge image

Using the Code

A small example to capture a button control image from a form by using a point on the button.

Private Sub ControlButton_Click(ByVal sender As System.Object, _
		ByVal e As System.EventArgs) Handles ControlButton.Click
        'Capture the image of this button including the cursor.
        Dim img As Image = SCapture.Control(Control.MousePosition, True)
        'Save the captured image.
        img.Save(filePath, Drawing.Imaging.ImageFormat.Png)
        'Also display the captured image in a PictureBox.
        Me.DisplayPictureBox.Image = img
    Catch ex As Exception
        'Show a MessageBox if the capture of image failed.
        MessageBox.Show("Failed to capture the control!" _
        & Environment.NewLine & ex.Message, "Capture Error!", _
        MessageBoxButtons.OK, MessageBoxIcon.Error)
    End Try
End Sub


  • Originally posted on 07/21/08
  • Updated on 08/05/08
    • Added an overloadable Window method that takes a point as one of its arguments and returns the bitmap of a window at the point
    • Changed all capture methods return types from Image to Bitmap


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Arman Ghazanchyan
Software Developer (Senior) ZipEdTech
United States United States
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralMy vote of 5 Pin
manoj kumar choubey23-Feb-12 21:49
membermanoj kumar choubey23-Feb-12 21:49 
Generalcode Pin
devindieranga12-Sep-09 18:30
memberdevindieranga12-Sep-09 18:30 
GeneralSource Pin
Neo-Code23-Jul-08 15:27
memberNeo-Code23-Jul-08 15:27 
GeneralRe: Source Pin
VBDT23-Jul-08 16:58
memberVBDT23-Jul-08 16:58 
GeneralRe: Source Pin
Neo-Code23-Jul-08 17:06
memberNeo-Code23-Jul-08 17:06 
GeneralRe: Source Pin
VBDT23-Jul-08 17:13
memberVBDT23-Jul-08 17:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170424.1 | Last Updated 5 Aug 2008
Article Copyright 2008 by Arman Ghazanchyan
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid