Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- internal static byte[] TakeDesktopScreenshot()
- {
- try
- {
- using (Bitmap b = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb))
- {
- using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(b))
- {
- g.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
- MemoryStream str = new MemoryStream();
- b.Save(str, ImageFormat.Jpeg);
- return str.ToArray();
- }
- }
- }
- catch
- {
- }
Advertisement
Add Comment
Please, Sign In to add comment