In this article we will create a small Snapshot Tool.
Since we are familiar with many ideas behind this. Right here, in Windows 7 we already have the Snipping Tool to do your job. In the earlier versions of the OS, we were restricted to the use of the Print Screen Key.
For now, we are using some of the classes of the .NET framework to make it work.
So, by the end of this article you will have such a tool.
Background
Actually, we are not going to include any external library file. That means, we will use an existing .NET library.
So, add a namespace to your project.
In other words, using the System.Drawing.Imaging namespace.
And the rest will be handled in Procedure section.
Procedure
Step 1
Before starting, have a look at my Solution Explorer:
Here, I have two Forms (Form1 and Settings).
Form1: It is the main Form1 form that looks like:
And the Settings Form looks like:
In fact, Form1 will be the Main Form and the Settings Form will appear when the end-user clicks a small Folder Button (in Form1).
And there, we set the image’s destination.
And at last we need a standalone class file, in other words Backend.cs.
Step 2
In the main form (Form1), we have a small folder button.
In that Click event, we need to use this:
Since Settings is the Form’s name and with that object we are calling the Show() method.
Step 3
So, when the Setting Form is called, then what?
In that form we have two Buttons.
Right here, we will focus on the Browse Folder Dialog button as in the following:
Step 4
Next we code the Ok (Tick) Button.
Note: Backend is the Class name that we have shown in the Solution Explorer.
It has a single static property named destination that stores the string type.
Backend.cs
Since it is not mandatory, you can try various approaches to do this.
Back to the Setting Form.
There use the Close() method to close the current form after the click event.
So the focus will return to Form1.
Step 5
In Form1 (the main form), we have a Capture Button.
For a screenshot, I have defined a user-defined method in the project (named Screenshot() ) and the rest will be handled in the event.
And that method will return a Boolean type showing whether or not it is completed successfully.
So, what does this method do?
2 Comments
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment
It is the same account you read, post and publish with — and you will come straight back to this page.





arslan elahiPosted May 10, 2014, 11:50 AM
thank you for posting as much simple code... but there is a problem... it is currently capture only one screen.. i have multiple monitors and it is capturing only one. ... i want to make to as it should capture multiple monitors ... your help in this matter will be much appreciated....
Sam HobbsPosted Jan 21, 2014, 5:16 PM
Since you mentioned the history of tools such as this, note that tools such as this have existed for about as long as Windows has existed. Thank you however for showing how to do it ourselves using managed code.