Screen capture sample code

xiaoxiao2021-03-05  24

using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Drawing.Imaging; public class Form1: Form {private Button button1; private System. ComponentModel.Container Components = NULL; Public Form1 () {// Initialization InitializeComponent () in InitializeComponent ();} // Clear Protected Override Void Dispose (Bool Disposing) {if (Disposing) {ix (components = null!) {components.Dispose ();}} base.Dispose (disposing);} private void InitializeComponent () {button1 = new Button (); SuspendLayout (); button1.Location = new System.Drawing.Point (64, 40); Button1.Name = "Button1"; button1.size = new system.drawing.size (80, 32); button1.tabindex = 0; button1.text = "Capture"; button1.click = New System.EventHandler (Button1_Click); autoscalebasesize = new system.drawing.size (6, 14); clientsize = new system.drawing.size (216, 125); Control S.Add (Button1); MaximizeBox = false; minimizebox = false; name = "form1"; text = "c # capture the current screen! "; ResumeLayout (false);} // declare an API function [System.Runtime.InteropServices.DllImportAttribute (" gdi32.dll ")] private static extern bool BitBlt (IntPtr hdcDest, // target DC handle int nXDest, int nYDest , Int nwidth, int nHEight, INTPTR HDCSRC, / / ​​source DC handle INT NXSRC, INT NYSRC, SYSTEM.INT32 DWROP / / raster processing value); static void main () {Application.Run (New Form1 ()); } Private void button1_click (object sender, system.eventargs e) {// Get the size Rect = New Rectangle Rect = New Rectangle ();

转载请注明原文地址:https://www.9cbs.com/read-36884.html

New Post(0)