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: |