1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
public static Bitmap ScreenshotFullScreen() { try { double dPrimaryScreenWidth = SystemParameters.PrimaryScreenWidth; double dPrimaryScreenHeight = SystemParameters.PrimaryScreenHeight; Bitmap bitmapScreenshot = new Bitmap((int)dPrimaryScreenWidth, (int)dPrimaryScreenHeight); Graphics graphicsScreenshot = Graphics.FromImage(bitmapScreenshot); graphicsScreenshot.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality; graphicsScreenshot.CopyFromScreen((int)0, (int)0, (int)0, (int)0, new System.Drawing.Size((int)dPrimaryScreenWidth, (int)dPrimaryScreenHeight)); return bitmapScreenshot; } catch (Exception ex) { TXTHelper.Logs(ex.ToString()); return null; } }
public static Bitmap ScreenshotsSpecifyLocation(int iStartX, int iStartY, int iInterceptWidth, int iInterceptHeight) { try { Bitmap bitmapScreenshot = new Bitmap((int)iInterceptWidth, (int)iInterceptHeight); Graphics graphicsScreenshot = Graphics.FromImage(bitmapScreenshot); graphicsScreenshot.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality; graphicsScreenshot.CopyFromScreen(iStartX, iStartY, (int)0, (int)0, new System.Drawing.Size((int)iInterceptWidth, (int)iInterceptHeight)); return bitmapScreenshot; } catch (Exception ex) { TXTHelper.Logs(ex.ToString()); return null; } }
|