Use C # To create a screen capture program (2)

Source: Internet
Author: User

Use C # To create a screen capture program (2)

In this way, the basic principles have been introduced. In general, the implementation principle is relatively simple. The following describes how to implement an instance:

1. Obtain a graphical object corresponding to the form on the screen

2. Create a bitmap file with the size of the form client area.

3. Get the context device of the form

4. Context device for obtaining bitmap files

5. Write the form on the screen to the bitmap.

6. Release the context device of the form

7. Release the context device of the bitmap file

8. Save the image as a jpeg file

Engineering steps:

1. Create a new C # project and name it "FormCapture", as shown below:

2. layout the main form:

Add a pictureBox control and a button control to the form. Set the Text attribute of the main form to "screen capture program", set the Image attribute of the Image box to a graphical file, and set the Text attribute of the button to "screen capture. (Of course, you can add the required controls to deploy the main form.) the figure is as follows:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.