using System; using System.Drawing; using System.Windows.Forms; namespace zhbCapture { /// <summary> /// Description of Utils. /// </summary> public class Utils { public static Bitmap screenBmp, srcScreenBmp; public static int screenWidth = Screen.PrimaryScreen.Bounds.Width; public static int screenHeight = Screen.PrimaryScreen.Bounds.Height; public static Size screenSize = Screen.PrimaryScreen.Bounds.Size; public static Point screenLocation = new Point(0, 0); public static Rectangle screenRect = new Rectangle(screenLocation, screenSize); public Utils() { } public static Bitmap getScreen(){ Bitmap bitmap = new Bitmap(screenWidth, screenHeight); using (Graphics g = Graphics.FromImage(bitmap)) { g.CopyFromScreen(0,0,0,0,screenSize); return bitmap; } } } }
Utils
时间: 2024-10-12 22:45:48